Free JSON Formatter & Validator

Beautify, minify and validate JSON — with errors pointed to the exact line.

Paste JSON to reformat it with consistent indentation, collapse it to a single line, or check whether it is valid at all. When parsing fails, the error is reported with the line and column so you can find it immediately instead of scanning the whole document. Everything runs in your browser; the data is never sent anywhere.

How it works

1

Paste your JSON

Drop in the text you want to check or tidy up.

2

Format or minify

Choose an indent width, or collapse everything to one line.

3

Copy the result

Invalid JSON is reported with the exact line and column.

What the validator actually checks

JSON is a stricter format than most people expect, and nearly every "invalid JSON" error comes down to one of five things. Trailing commas after the last item in an object or array are not allowed, even though most programming languages tolerate them. Keys must be wrapped in double quotes — {name: "x"} is JavaScript, not JSON. Single quotes are never valid, for keys or values. Comments do not exist in the specification, so a // line will fail. And NaN, Infinity and undefined are not JSON values, which is why serialising certain JavaScript objects produces output that cannot be parsed back.

This tool parses with the browser's own JSON engine, so it accepts exactly what your code will accept — no more and no less. If it validates here, JSON.parse() will succeed in any environment.

Formatting versus minifying

Formatting adds newlines and indentation so the structure is readable. It changes nothing about the data: the parsed result is identical either way, since whitespace between tokens carries no meaning in JSON. Use it when reading an API response or diffing two payloads, where consistent indentation makes changes obvious.

Minifying strips every optional space and newline. For a typical configuration file this saves 15-30% of the bytes, which matters for anything sent over a network on every request. It is worth remembering that gzip or brotli compression, which almost every server applies, already removes most of that redundancy — so minifying JSON that is served compressed gains far less than the raw byte count suggests.

One practical note: key order is preserved exactly as written. JSON objects are unordered by specification, but every mainstream parser keeps insertion order, so formatting will not shuffle your keys.

Frequently Asked Questions

Almost always a trailing comma, a single quote, or an unquoted key. The error message here includes the line and column, which narrows it down immediately. Watch particularly for a comma after the final element of an array or object.
No. The specification has no comment syntax, so a // or /* */ line makes the document invalid. Formats such as JSON5 and JSONC add comments, but standard parsers reject them. If you need annotation, add a regular key like "_comment".
No. Whitespace between tokens has no meaning in JSON, so the parsed result is byte-for-byte equivalent. Key order is preserved as written.
No. Parsing uses your browser's built-in JSON engine and the text never leaves the page. That matters when the payload contains tokens, personal data or anything else you would not paste into a random website.
Several megabytes without trouble. The limit is browser memory rather than an imposed cap. Very large documents may take a moment to re-render in the output box.