File: //opt/alt/ruby32/share/gems/doc/json-2.16.0/ri/JSON/parse-i.ri
U:RDoc::AnyMethod[iI"
parse:ETI"JSON#parse;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"DReturns the Ruby objects created by parsing the given +source+.;To:RDoc::Markup::BlankLine o;
; [I"9Argument +source+ contains the \String to be parsed.;T@o;
; [I"MArgument +opts+, if given, contains a \Hash of options for the parsing. ;TI"?See {Parsing Options}[#module-JSON-label-Parsing+Options].;T@S:RDoc::Markup::Rule:weighti@o;
; [I";When +source+ is a \JSON array, returns a Ruby \Array:;To:RDoc::Markup::Verbatim; [ I"0source = '["foo", 1.0, true, false, null]'
;TI"ruby = JSON.parse(source)
;TI".ruby # => ["foo", 1.0, true, false, nil]
;TI"ruby.class # => Array
;T:@format0o;
; [I";When +source+ is a \JSON object, returns a Ruby \Hash:;To;; [ I"Isource = '{"a": "foo", "b": 1.0, "c": true, "d": false, "e": null}'
;TI"ruby = JSON.parse(source)
;TI"Gruby # => {"a"=>"foo", "b"=>1.0, "c"=>true, "d"=>false, "e"=>nil}
;TI"ruby.class # => Hash
;T;0o;
; [I";For examples of parsing for all \JSON data types, see ;TI"6{Parsing \JSON}[#module-JSON-label-Parsing+JSON].;T@o;
; [I" Parses nested JSON objects:;To;; [I"source = <<~JSON
;TI" {
;TI" "name": "Dave",
;TI" "age" :40,
;TI" "hats": [
;TI" "Cattleman's",
;TI" "Panama",
;TI" "Tophat"
;TI" ]
;TI" }
;TI"
JSON
;TI"ruby = JSON.parse(source)
;TI"Xruby # => {"name"=>"Dave", "age"=>40, "hats"=>["Cattleman's", "Panama", "Tophat"]}
;T;0S;;
i@o;
; [I"7Raises an exception if +source+ is not valid JSON:;To;; [I"?# Raises JSON::ParserError (783: unexpected token at ''):
;TI"JSON.parse('');T;0:
@fileI"lib/json/common.rb;T:0@omit_headings_from_table_of_contents_below0I"(JSON.parse(source, opts) -> object
;T0[ I"(source, opts = nil);T@GFI" JSON;TcRDoc::NormalModule00