Ruby 3 · Errors and files
Work with JSON
Convert between Ruby hashes and JSON text.
require "json"
text = JSON.generate({ name: "Ada", tags: ["a", "b"] })
data = JSON.parse(text, symbolize_names: true)
Ruby 3 · Errors and files
Convert between Ruby hashes and JSON text.
require "json"
text = JSON.generate({ name: "Ada", tags: ["a", "b"] })
data = JSON.parse(text, symbolize_names: true)
Was this page helpful?