JSON Formatter and Validator
Validation and formatting run in your browser, so configuration files, API responses and anything else you paste stay on your machine.
Paste messy or minified JSON to check whether it is valid, see exactly where any error is, and get back both a properly indented version and a minified one. Everything is parsed locally in your browser.
How it works
The text is handed to the browser's own JSON parser — the same one your code will use — so if it validates here it will validate in your application. Once parsed, it is written back out twice: once with indentation for reading, once with none for transmission.
When parsing fails, the browser reports the character offset where it stopped. That offset is converted into a line and column by counting the newlines before it, which is far easier to act on than a raw number.
Because the data is genuinely parsed rather than pattern-matched, the summary can report what the top level actually is and how many keys or items it holds.
Worked example
Pasting {"b":1,"a":[1,2,3]} returns it indented across several lines, reports an object with two keys, and gives the minified form back unchanged since it was already compact.
Introduce a trailing comma — {"a":1,} — and it reports the failure with a line and column. That single character is probably the most common JSON error there is, because most programming languages allow it and JSON does not.
Common questions
What makes JSON invalid?
Usually one of three things: a trailing comma after the last item, single quotes instead of double, or an unquoted key. All three are legal in JavaScript but not in JSON, which catches people out constantly.
Where does the error position come from?
The browser reports the character offset where parsing failed, which is translated here into a line and column. Bear in mind the reported spot is where the parser gave up, not always where the mistake is — a missing bracket is often flagged several lines later.
Does formatting change my data?
No. The text is parsed into real values and written back out, so only whitespace changes. One thing to note: object keys keep their original order, but any duplicate keys are collapsed, since JSON objects cannot hold the same key twice.
What is minified JSON for?
Removing every unnecessary space and line break makes the payload smaller, which matters for API responses and anything sent over a network at volume. It is unreadable to humans, which is why both versions are shown here.
Can I paste an API response with sensitive data?
Everything is parsed in your browser and nothing is transmitted, so yes — that is precisely why this runs client-side. Many online JSON formatters send your input to a server, which is a poor idea for anything containing tokens or personal data.
Why does it say "top level" and count keys?
As a quick sanity check. If you expected an array of results and it reports an object with two keys, you have probably pasted a wrapper rather than the data inside it — which is faster to spot from a summary than by reading the output.