JSON Formatter & Validator

Format, validate, and minify JSON with clear error messages.

About this tool

Paste any JSON to check whether it's valid and see it reformatted with clean indentation and a collapsible tree view. When something is wrong, the error message names the problem and points at roughly where it is, rather than leaving you to hunt. Minify does the reverse — it strips every unnecessary space and newline for the smallest output. Everything runs locally in your browser; nothing is uploaded.

The whole JSON grammar. A JSON document is exactly one value. A value is an object { } of "key": value pairs, an array [ ] of values, a double-quoted string, a number, true, false, or null. Keys must be double-quoted strings. There are no comments, no trailing commas, and no single quotes. That's the entire specification.

What usually breaks it. Most "invalid JSON" errors are habits carried over from JavaScript or Python: a trailing comma after the last item, single-quoted or unquoted keys, // comments, undefined or NaN as a value, a number written as .5 or 1., or smart quotes pasted from a word processor. A stray byte-order mark at the very start of a file is another common one.

Numbers need care. JSON numbers are arbitrary-precision on paper, but most parsers load them into a 64-bit float. Integers beyond 253 lose precision silently, so a large ID like 9007199254740993 can read back changed. If a value is an identifier rather than a quantity — or if it's money — send it as a string.

Formatting never changes the data. Reindenting or minifying only touches whitespace. Keys, values, order within arrays, and structure are preserved exactly. (Object key order is not significant in JSON, though most parsers keep it.)

To move between JSON and other formats, use the YAML ⇄ JSON converter; to read the claims inside a token, use the JWT decoder. The guide to reading and validating JSON covers the grammar and the common errors in full.

Frequently asked questions

What counts as invalid JSON?
Trailing commas, single quotes instead of double quotes, unquoted keys, comments, undefined/NaN values, and missing brackets. JSON is much stricter than a JavaScript object literal.
Does formatting change my data?
No. Formatting and minifying only change whitespace and indentation. Every key, value, and structural relationship is preserved exactly.
Where does the error message come from?
From the browser's own JSON parser. It reports the first syntax problem it hits, usually with a position, so you can jump straight to the offending character.
Is there a size limit?
There's no hard limit, but very large documents (several megabytes) can be slow to format since all the work happens in your browser. Everyday JSON is instant.
Why did my big number change when I formatted it?
JSON numbers are parsed as 64-bit floats, which can't represent every integer above about 9 quadrillion exactly. Store large IDs and precise decimal amounts as strings to avoid this.
Can it handle JSON with comments (JSONC / JSON5)?
Standard JSON has no comments, so a document with // or /* */ is reported as invalid. Remove the comments, or use a parser that explicitly supports those extensions.
What about duplicate keys?
The spec doesn't forbid them but doesn't define what they mean either. Most parsers keep the last value; don't rely on it — deduplicate before you serialize.