Sha256: b9794fc8ec834e19414b255bc0e677f5ba552c9f7a3fde6babe08287b509bdbb
Contents?: true
Size: 512 Bytes
Versions: 19
Compression:
Stored size: 512 Bytes
Contents
# frozen_string_literal: true require "json" require "http/mime_type/adapter" module HTTP module MimeType # JSON encode/decode MIME type adapter class JSON < Adapter # Encodes object to JSON def encode(obj) return obj.to_json if obj.respond_to?(:to_json) ::JSON.dump obj end # Decodes JSON def decode(str) ::JSON.parse str end end register_adapter "application/json", JSON register_alias "application/json", :json end end
Version data entries
19 entries across 19 versions & 1 rubygems