JSON Formatter & Validator
Pretty-print, validate or minify JSON. Everything runs in your browser — your data is never uploaded.
About JSON Formatter
JSON Formatter takes a wall of unreadable JSON and lays it out with proper indentation, or collapses a formatted document back down to the smallest valid form. If the JSON is malformed it tells you the line and column of the problem rather than simply refusing to continue.
Most JSON people actually deal with arrives unreadable. An API response is transmitted minified because every removed space is bandwidth, a log line is a single 4,000-character string, and a config file has been edited by three different tools with three different opinions about indentation. None of it is wrong, but none of it can be read either, and squinting at nested braces in a terminal is how mistakes get missed.
The validation half matters more than the formatting. JSON is unforgiving in ways that are easy to trip over: a trailing comma after the last array element, single quotes where the spec demands double, an unquoted key copied out of a JavaScript object literal, or a smart quote silently introduced by pasting through a word processor. Any one of these makes a parser reject the entire document with a message that often points at the wrong place. Getting a line and column back turns a ten-minute hunt into a five-second fix.
How to format and validate JSON
- Paste your JSON into the input box.
- Choose an indent width — two spaces, four spaces or a tab.
- Click Format to beautify it, or Minify to strip every optional space.
- If the JSON is invalid, read the reported line and column and correct that spot.
- Copy the result, or download it as a .json file.
Tips & common problems
Trailing commas are the usual culprit
JavaScript tolerates a comma after the last item in an array or object; JSON does not. If a document fails to parse near the end of a block, look for one.
Minify for transport, format for humans
Minified JSON is meaningfully smaller over the wire, which is why APIs send it. Format it while you are reading it, and keep the minified version for anything that gets transmitted.
Watch for smart quotes
Copying JSON through a word processor or chat client can convert straight quotes into typographic ones, which look nearly identical but are not valid JSON. Retyping the offending quote fixes it.
A lone value is still valid JSON
A bare string, number or boolean parses fine on its own. If you expected an object and got a plain value back, the problem is upstream in whatever produced it.
Frequently asked questions
Is my JSON uploaded to a server?
No. Formatting and validation happen entirely in your browser using the built-in JSON parser. Nothing is transmitted, which matters because API responses routinely contain tokens and personal data.
What's the difference between formatting and minifying?
Formatting adds indentation and line breaks so a human can read the structure. Minifying removes every optional character to produce the smallest valid equivalent, which is what you want when sending it over a network.
Why does my JSON say it's invalid when it looks fine?
The usual causes are a trailing comma, single instead of double quotes, an unquoted key, or a smart quote introduced by copy-paste. The error message gives you a line and column to check first.
Can it handle very large JSON files?
It handles large documents comfortably, though extremely large ones — many megabytes — depend on your device's available memory, since everything is processed locally.
Does formatting change my data?
No. Only whitespace changes. The parsed structure, key order, values and types are all preserved exactly.
Can I use this for JSON with comments?
No, because comments are not part of the JSON specification and a standards-compliant parser rejects them. Formats like JSONC and JSON5 allow them, but they must be stripped before parsing as plain JSON.