🔧 JSON Formatter & Validator
Paste raw or minified JSON on the left — get it beautified, validated, and ready to copy on the right.
JSON that arrives minified is technically valid and practically unreadable. This formatter parses your input and reprints it with indentation, which turns a single 4,000-character line into a structure you can actually scan. It also validates as it goes: if the input is malformed you get the parse error and the position rather than a silent failure, which is usually the faster way to find the missing comma.
The errors that actually break JSON
Most broken JSON fails for one of four reasons: a trailing comma after the last item, single quotes instead of double quotes, an unquoted key, or a comment. None of these are legal in the JSON specification, though JavaScript object literals tolerate all of them, which is where the confusion comes from. Copying a config snippet out of a JavaScript file into a .json file is the single most common way to produce invalid JSON.
Why minified and pretty differ in size
Indentation adds two to four spaces per nesting level. On a deeply nested document that can double the byte count. For an API payload you send over the network, minified is correct — the whitespace is wasted bytes. For a config file a human will read, pretty printing is correct. The formatter shows both so you can see how much of your file is structure rather than data.
Numbers that JSON cannot hold
JSON has one number type, a double-precision float. That means very large integers lose precision: identifiers above 2^53 do not survive a round trip through a parser. It also means there is no way to represent NaN or Infinity — both are valid in JavaScript and both are invalid JSON. If your data contains either, it is usually serialized as null or as a string, and that conversion is lossy.
Frequently asked questions
Can I use comments in JSON?
Not in standard JSON. JSON5 and JSONC allow comments, and many editors accept them, but a strict parser will reject the file. If you need comments in configuration, use YAML or TOML instead.
Why did my large number change after formatting?
Because JSON stores all numbers as double-precision floats. Integers above 2^53 cannot be represented exactly, so a long identifier will come back slightly different. Store such IDs as strings to avoid this.
Does the formatter validate or just format?
Both. The input is parsed first, and parsing fails on invalid JSON. If you get formatted output, the input was valid.