module JSON

def parse(source, opts = nil)


JSON.parse('')
# Raises JSON::ParserError (783: unexpected token at ''):
Raises an exception if +source+ is not valid JSON:

---

ruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
ruby = JSON.parse(source)
JSON
}
]
"Tophat"
"Panama",
"Cattleman's",
"hats": [
"age" :40,
"name": "Dave",
{
source = <<~JSON
Parses nested JSON objects:

{Parsing \JSON}[#module-JSON-label-Parsing+JSON].
For examples of parsing for all \JSON data types, see

ruby.class # => Hash
ruby # => {"a"=>"foo", "b"=>1.0, "c"=>true, "d"=>false, "e"=>nil}
ruby = JSON.parse(source)
source = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}'
When +source+ is a \JSON object, returns a Ruby \Hash:

ruby.class # => Array
ruby # => ["foo", 1.0, true, false, nil]
ruby = JSON.parse(source)
source = '["foo", 1.0, true, false, null]'
When +source+ is a \JSON array, returns a Ruby \Array:

---

See {Parsing Options}[#module-JSON-label-Parsing+Options].
Argument +opts+, if given, contains a \Hash of options for the parsing.

Argument +source+ contains the \String to be parsed.

Returns the Ruby objects created by parsing the given +source+.

JSON.parse(source, opts) -> object
:call-seq:
def parse(source, opts = nil)
  opts = ParserOptions.prepare(opts) unless opts.nil?
  Parser.parse(source, opts)
end