Class with attr_accessor or symbol-keyed hash?
The generator emits a class with attr_accessor for every JSON key plus an initialize(data = {}) method that accepts both symbol-keyed (data[:name]) and string-keyed (data["name"]) hashes — that is the same pattern used internally by Stripe, Twilio, and the official Ruby SDKs. If you only need a value-object wrapper without methods, replace the class with a Struct.new(:id, :name, ...) one-liner; if you want immutability use Data.define(:id, :name, ...) (Ruby 3.2+).
How do I deserialize a JSON string into the generated class?
require 'json'; data = JSON.parse(json_string, symbolize_names: true); root = Root.new(data) — the symbolize_names option is what makes data[:name] work directly. Without it, JSON.parse returns string keys and the generated initializer falls back to data['name'] thanks to the || operator.
Will the generated class work with Rails?
Yes. The generated class is a plain Ruby object — drop it into app/models/ if it represents a database record (then have it inherit from ApplicationRecord), or into app/services/ as a value object. For ActiveModel-style validations and serializers add include ActiveModel::Model and include ActiveModel::Serializers::JSON.
How are nested JSON objects modelled?
Each nested object becomes its own top-level Ruby class so you can require_relative each one separately. The parent class stores the nested data as the raw hash — to get a typed nested instance, call Address.new(@address) inside an accessor method or wire the conversion in initialize for eager instantiation.
How are JSON arrays of objects handled?
Arrays of primitives (strings, integers) come through as plain Ruby arrays — no transformation required. Arrays of nested objects come through as arrays of hashes; map them through the matching class: @items = data[:items].map { |item| Item.new(item) } in your initialize.
Can I use this with the Sidekiq, Sequel, or ROM gems?
Yes. The generated PORO works as a Sidekiq job argument (after to_h) and as a presenter on top of a Sequel or ROM result row. The accessors and initializer signatures are deliberately stdlib-only so they compose with any Ruby framework.
How are JSON keys with hyphens or Ruby reserved words handled?
A JSON key like "user-id" is invalid as a Ruby instance variable; rename the symbol after copying (e.g. :user_id) and translate inside initialize: @user_id = data[:"user-id"]. Reserved words like "class" or "end" cannot be method names — suffix them (class_name) and translate the same way.
Is the JSON uploaded to your servers?
No. Conversion runs entirely in your browser via JavaScript. Open DevTools → Network and click Convert — no requests are made. JSON containing API keys, internal field names, or PII never leaves your machine.