📁 File Manager Pro
v10.0.3 | PHP: 8.1.34
Server: Apache
2026-06-22 03:11:30
📂
/ (Root)
/
opt
/
alt
/
ruby30
/
share
/
ri
/
system
/
JSON
📍 /opt/alt/ruby30/share/ri/system/JSON
🔄 Refresh
✏️
Editing: parse-i.ri
Read Only
U:RDoc::AnyMethod[iI" parse:ETI"JSON#parse;TF:privateo: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 = <<-EOT ;TI"{ ;TI""name": "Dave", ;TI" "age" :40, ;TI" "hats": [ ;TI" "Cattleman's", ;TI" "Panama", ;TI" "Tophat" ;TI" ] ;TI"} ;TI" EOT ;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" ext/json/lib/json/common.rb;T:0@omit_headings_from_table_of_contents_below0I"(JSON.parse(source, opts) -> object ;T0[ I"(source, opts = {});T@GFI" JSON;TcRDoc::NormalModule00
💾 Save Changes
❌ Cancel