JSON Formatter
Format, validate, and beautify messy JSON with one click.
Paste in messy, minified, or inconsistently indented JSON and get it formatted, validated, and beautified with one click — with clear error messages pointing to exactly where invalid JSON breaks, rather than a cryptic parser failure.
Also useful for quickly checking whether an API response or config file is actually valid JSON before debugging further.
The syntax errors that account for most failures
| Mistake | Invalid | Valid |
|---|---|---|
| Trailing comma | [1, 2, 3,] | [1, 2, 3] |
| Single quotes | {'a': 1} | {"a": 1} |
| Unquoted key | {a: 1} | {"a": 1} |
| Comment | // note | Not supported in strict JSON |
| Leading zero | {"a": 007} | {"a": 7} |
| undefined / NaN | {"a": NaN} | {"a": null} |
JSON is stricter than JavaScript object literal syntax. Code that runs fine in a .js file is frequently not valid JSON.
Things JSON deliberately cannot represent
- Comments. JSON was designed as a data interchange format, and comments were left out on purpose. JSON5 and JSONC add them, but strict parsers reject them.
- Dates. There is no date type — dates travel as strings, conventionally ISO 8601 ("2026-09-17T10:14:00Z").
- Integers beyond 2⁵³. JSON numbers are IEEE doubles in most parsers, so very large IDs lose precision. Send them as strings.
- Trailing commas, NaN, Infinity, and undefined — all common in JavaScript, all invalid in JSON.
- Circular references. An object that contains itself cannot be serialised.
Reading a parser error
Parser messages point to where the parser gave up, which is usually just after the real mistake rather than at it. A missing comma on line 12 typically reports as an unexpected token on line 13.
The practical technique: when the reported position looks fine, check the line above it. For unbalanced brackets, formatting the document first often makes the structure obvious — the indentation will visibly fail to return to zero.
Frequently asked questions
- What happens if my JSON is invalid?
- The tool shows a clear error indicating roughly where the syntax breaks — a missing comma, unmatched bracket, or trailing comma are the most common culprits.
- Can this minify JSON as well as beautify it?
- Yes — switch to compact/minify mode to strip whitespace back out once you're done editing, for a smaller payload.
- Does formatting change the actual data?
- No — formatting only affects whitespace and indentation for readability; the underlying keys, values, and structure are unchanged.
- Why does JSON reject comments?
- They were deliberately excluded so the format stayed a pure data interchange format with no room for parser-specific behaviour. Use JSON5, JSONC or a separate documentation field if you need them.
- Why did my large ID number change value?
- JSON numbers are parsed as IEEE 754 doubles in most languages, which lose precision above 2⁵³ (about 9 quadrillion). Snowflake IDs and similar should be transmitted as strings.
- Is my pasted JSON sent to a server?
- No. Parsing and formatting happen entirely in your browser, so API responses containing tokens or personal data stay on your machine.