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
Paste your JSON
Drop in the text you want to check or tidy up.
Format or minify
Choose an indent width, or collapse everything to one line.
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.