gems.multi_json-1.12.1.lib.multi_json.adapters.json_common.rb Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sass-maven-plugin Show documentation
Show all versions of sass-maven-plugin Show documentation
A Maven Plugin that compiles Sass files.
require 'multi_json/adapter'
module MultiJson
module Adapters
class JsonCommon < Adapter
defaults :load, :create_additions => false, :quirks_mode => true
def load(string, options = {})
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
© 2015 - 2025 Weber Informatics LLC | Privacy Policy