Convert between Ruby objects and JSON formats instantly
Ruby/JSON Converter
How it works
Parsing Input
The Ruby hash is parsed, handling symbol keys (`:key`), string keys (`'key'`), hash rockets (`=>`), and nested structures. It attempts to evaluate the input safely.
Type Conversion & Formatting
Ruby symbols and strings are converted to JSON strings (with double quotes), `nil` becomes `null`, arrays remain arrays, and the structure is formatted as standard JSON.
Examples
{ name: "Alice Wonderland", age: 30, is_student: false, courses: ["Literature", "Logic"], address: { street: "123 Rabbit Hole Ln", city: "Fantasia", zip: nil }, 'string-key' => 'value for string key' }
{ "name": "Bob The Builder", "age": 45, "isStudent": false, "skills": ["Construction", "Problem Solving", "Teamwork"], "address": { "city": "Bobsville", "country": "USA" }, "contact": null }