Using Symbols

suggest change

You can use JSON together with Ruby symbols. With the option symbolize_names for the parser, the keys in the resulting hash will be symbols instead of strings.

json = '{ "a": 1, "b": 2 }'
puts JSON.parse(json, symbolize_names: true)
>> {:a=>1, :b=>2}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents