Sha256: 658f2601d9fa1f18ac2b3ac01e2c62d8a6ee5bd978aefabb368315852c7013bf
Contents?: true
Size: 480 Bytes
Versions: 11
Compression:
Stored size: 480 Bytes
Contents
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.load str end end register_adapter 'application/json', JSON register_alias 'application/json', :json end end
Version data entries
11 entries across 11 versions & 1 rubygems