Using Symbols

suggest change

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

require 'json'

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