Module: S3MPI::Converters::JSON

Extended by:
JSON
Included in:
JSON
Defined in:
lib/s3mpi/converters/json.rb

Instance Method Summary collapse

Instance Method Details

#generate(object, options = Hash.new) ⇒ Object



13
14
15
# File 'lib/s3mpi/converters/json.rb', line 13

def generate(object, options = Hash.new)
  object.to_json(options)
end

#parse(json_string, options = Hash.new) ⇒ Object



8
9
10
11
# File 'lib/s3mpi/converters/json.rb', line 8

def parse(json_string, options = Hash.new)
  opts = { quirks_mode: true }.merge(options)
  ::JSON.parse(json_string || 'null', **opts)
end