Ruby Hash to JSON
Parse Ruby hash literals and symbol-key hashes into valid JSON for APIs and debugging.
Convert Ruby hash literals to JSON
Ruby configuration dumps, Rails console output, and spec fixtures often use hash rockets (=>),
symbol keys (:id), or JSON-style keys (name:). This converter parses common Ruby hash and
array literals into strict JSON you can paste into APIs, OpenAPI examples, or test fixtures.
For the opposite direction, use
JSON to Ruby Hash.
Complex Ruby code (method calls, splats, or arbitrary expressions) is not supported, only literal hashes,
arrays, strings, numbers, booleans, and nil.
Supported syntax
- Hash rockets and
key: valueshorthand - Double- and single-quoted string keys and values
- Nested hashes and arrays
true,false, andnil
Frequently Asked Questions
Why did parsing fail on valid Ruby?
The parser targets literal data structures, not full Ruby syntax. Remove method calls, variables, and dynamic expressions before converting.
How are symbol keys handled?
Symbol keys such as :id become JSON string keys ("id").
Is my code sent to a server?
No. Parsing and JSON formatting run locally in your browser.