Sha256: 61156fa2af774964b0f2ff46f1981c780d0e9cc7d33d1a32f5a74a984cc52ccd
Contents?: true
Size: 698 Bytes
Versions: 98
Compression:
Stored size: 698 Bytes
Contents
require 'multi_json/adapter' module MultiJson module Adapters class JsonCommon < Adapter defaults :load, :create_additions => false, :quirks_mode => true def load(string, options={}) string = string.read if string.respond_to?(:read) if string.respond_to?(:force_encoding) string = string.dup.force_encoding(::Encoding::ASCII_8BIT) end options[:symbolize_names] = true if options.delete(:symbolize_keys) ::JSON.parse(string, options) end def dump(object, options={}) options.merge!(::JSON::PRETTY_STATE_PROTOTYPE.to_h) if options.delete(:pretty) object.to_json(options) end end end end
Version data entries
98 entries across 90 versions & 10 rubygems