JSON formatter
Format ugly JSON into readable indentation, minify it back, and see exactly where a syntax error is.
The code for this tool is fetched only when you open it.
What json formatter does
JSON formatter pretty-prints a payload with configurable indentation, or minifies it back to one line, and reports the parse error with a position when the input is broken. It is the tool for the API response pasted out of a log and the config file that will not load.
How it works
JSON.parse followed by JSON.stringify with an explicit indent, so the output is exactly what a JavaScript engine considers valid rather than a text tidy-up that might change values.
The file never leaves this tab. It is decoded by the browser, worked on in memory and encoded again — no request carries it, and there is no server-side copy to delete afterwards because none is made.
Formats and limits
| Limits | No practical limit — a few megabytes of JSON formats instantly. Nesting depth is bounded by the engine, not by this tool. |
|---|---|
| Price | Free, unlimited, no account |
Worth knowing
- Parsing and re-serialising normalises the document: duplicate keys collapse to the last value and number formatting is standardised. That is a faithful round-trip through a real parser, not a cosmetic reformat.
- The error message carries the character offset, which is what makes a malformed 4000-line payload fixable rather than a guessing game.
Questions about json formatter
Does it validate my JSON or just format it?
It validates as a side effect of parsing. If the document is invalid you get an error and no formatted output, because there is nothing valid to format.
Why did my comments disappear?
Because JSON does not have comments. Anything the parser accepts as JSON has no comment syntax; if your file has them it is JSON5 or JSONC and needs a different parser.
Is my payload sent anywhere?
No. Parsing happens in the tab. Tokens and API responses can be pasted here without the data leaving your machine.
Why does my JSON fail?
The usual causes are a trailing comma, single quotes instead of double, or an unquoted key. The error message names the character position.
Does it reorder my keys?
No. Key order is preserved as parsed.
Where is my file processed?
No. There is no upload step and no server-side copy: the browser decodes and re-encodes the file in this tab, and the network carries nothing about it.
Does it work offline?
Once the page has loaded, yes — the processing code runs locally and no further request is needed. The first load has to come from the network like any page.
What does it cost?
Free with no account and no daily limit — counting and calculating are not metered, because they cost nothing to run.