Paste JSON, or open a file, and the tool checks it, formats it, and shows it three ways: as formatted text, as a collapsible tree, and as a Ruby hash literal you can drop into a spec, a seed file or a console session.
How it works#
The input is parsed by a small scanner written for this tool, following RFC 8259. It does not use the browser’s JSON.parse to build the result, for two reasons. First, JSON.parse turns every number into a JavaScript float, so 12345678901234567890 comes back as 12345678901234567000; a formatter must never change data. Second, JSON.parse moves integer-like keys such as "10" to the front of an object. The scanner keeps every number, every string escape and every key exactly as you wrote them, so formatting changes only whitespace.
When the text is invalid, the scanner stops at the first character it cannot accept and explains why in plain words: a trailing comma, a single-quoted string, an unquoted key, a comment, True instead of true, a curly quote pasted from a document. The browser’s own JSON.parse is run on the same text, and when its message names a position, that position is used, so the line and column match what your browser console reports. The line around the error is shown with a caret under the character.
Sort keys orders the keys of every object by Unicode code point, at every level, including objects inside arrays. That is the order Ruby gives when it sorts strings, which is handy when you diff two API responses. Keys that appear twice keep their original order.
Inputs over 1 MB are processed in a Web Worker so the page stays responsive. The limit is 5 MB, and a file larger than that is refused before it is read.
A worked example#
Load example fills in a user record with a 20-digit id, a key with a hyphen and a null. The tool reports it as valid with one warning: line 2 holds 12345678901234567890, which is larger than 2^53, and JavaScript would read it as 12345678901234567000. The formatted output keeps all 20 digits. With symbol keys, the Ruby view starts like this:
{
user: {
id: 12345678901234567890,
name: "Ada Lovelace",
admin: false,
"my-key": "kept as a quoted symbol",
roles: [
"owner",
"billing"
],
Broken example has a trailing comma inside an array. The tool reports line 3, column 32, and puts the caret under the closing bracket: “Expected a value after ’,’. JSON does not allow a trailing comma.”
Ruby and Rails#
The two key styles match the two ways Ruby parses JSON. JSON.parse(body) returns string keys, so the hash reads { "user" => { "id" => … } }. JSON.parse(body, symbolize_names: true) returns symbols, including quoted ones like :"my-key". The Ruby view writes null as nil and escapes #{ so nothing is interpolated when you paste it.
Numbers behave differently on each side. Ruby’s JSON.parse reads 12345678901234567890 as an exact Integer, so a Rails API can send 64-bit IDs without noticing anything wrong, while the JavaScript client silently rounds them. Decimals become Floats; pass decimal_class: BigDecimal to keep every digit.
as_json has its own surprises when Rails builds the response:
- A
BigDecimalis encoded as a string, so apricecolumn of149.90arrives as"149.9". - A
Timebecomes an ISO 8601 string with milliseconds:"2026-11-30T14:05:00.000Z". - Symbol keys become strings, so
JSON.parse(hash.to_json)does not give back the hash you started with unless you passsymbolize_names: true. - A
NaNor infinite Float becomesnull, whereJSON.generatewithout Active Support raises instead.
If a key appears twice, both Ruby and JavaScript keep the last value. Recent versions of the json gem also print a deprecation warning that json 3.0 will raise unless you pass allow_duplicate_key: true. The tool lists duplicates with their line numbers.
Limitations#
- One JSON value per input. JSON Lines (one document per line), comments and JSON5 syntax are reported as errors.
- Nesting deeper than 512 levels is rejected.
- Formatted output keeps string escapes as written; it does not convert
étoéor the reverse. - The tree shows 200 children at a time, and Expand all opens up to 2,000 nodes.
- In the Ruby view, decimals are Ruby Floats, as
JSON.parsemakes them, and an unpaired\uD800-style escape is replaced with U+FFFD because Ruby rejects it.
More tools are on the developer tools page.
Frequently asked questions
Why does it warn that a number is larger than 2^53?
JavaScript stores every number as a 64-bit float, which holds whole numbers exactly only up to 9,007,199,254,740,991. JSON.parse in a browser silently rounds anything bigger, so 12345678901234567890 becomes 12345678901234567000. This tool never rounds, and Ruby reads such numbers exactly, but a JavaScript client of your API will not. Send large IDs as strings.
Why are some Ruby keys written with quotes, like "my-key": 1?
Ruby only allows the short name: form for keys that look like identifiers: letters, digits and underscores, not starting with a digit, optionally ending in ? or !. Anything else, such as my-key or 1st, has to be quoted. "my-key": 1 is still a symbol key, the same one JSON.parse(text, symbolize_names: true) returns.
Why are comments and trailing commas rejected?
Because JSON does not allow them, and JSON.parse in Ruby and JavaScript rejects them too. Formats such as JSON5 or JSONC add them, but a file that relies on them will fail in production code. The error names the problem and points at the exact character.
Is my JSON uploaded anywhere?
No. Pasted text and opened files are processed in this tab, in a Web Worker for inputs over 1 MB, and the page sends nothing. A share link carries the JSON only when it is 1,500 characters or fewer, inside the URL fragment, which browsers do not send to the server. Larger documents share only the options.