What is a JSON formatter?
A JSON formatter takes raw JSON and rewrites it in a consistent, human-readable shape — adding indentation so nested structures are visible, normalizing whitespace, and (often) sorting keys for diff-friendliness. Behind the scenes it’s a parse step followed by a stringify step: the input is turned into an in-memory value, then serialized back out with your chosen indent.
JSONZen’s formatter goes one step further: when the input is broken, it doesn’t just print “Invalid JSON” — it tells you the exact line and column where the parser gave up, and highlights it in the editor.
When do you need one?
- You copied a one-line JSON blob from a network tab and need to read it.
- Your build output, log, or API response is minified and unreadable.
- You’re committing a configuration file and want consistent indent + sorted keys so diffs stay clean.
- You’re debugging a “SyntaxError: Unexpected token” and need to know which character caused it.
How to use it (3 steps)
- Paste your JSON into the left panel.
- Pick an indent (2 spaces, 4 spaces, or tabs) and switch to Sorted JSON if you want alphabetical keys.
- Click Copy in the bottom-left to put the formatted output on your clipboard.
Everything happens in your browser. Nothing is sent to a server, ever. Close the tab and your data is gone — that’s the privacy promise.
Common errors, decoded
- Unexpected token } in JSON
- You probably have a trailing comma right before that closing brace. Vanilla JSON doesn’t allow trailing commas (JSON5 does, but the spec doesn’t).
- Unexpected end of input
- A bracket, brace, or quote was left open. Scroll to the bottom — you’re missing a closer somewhere on the way there.
- Unexpected token a in JSON at position 1
- The first non-whitespace character is a letter, which means an unquoted key (e.g.
{a:1}) or a JavaScript object literal that isn't valid JSON. Wrap keys in double quotes.