require 'json'
data = {"test" => 123}
puts JSON.generate(data)
require 'json'
document = "{\"test\":123}"
puts JSON.parse(document)
require 'json'
data = JSON '{"test":23}' # => {"test"=>23}
or
require 'json'
data = JSON['{"test":23}'] # => {"test"=>23}
require 'json'
document = JSON 'test' => 23 # => "{\"test\":23}"
or
require 'json'
document = JSON['test' => 23] # => "{\"test\":23}"
Parameter | Details |
---|---|
json_document_string | A JSON document in the form of a String |
ruby_hash | Any Hash object |