JSON Formatter

Paste JSON and read it. Indent it to your liking, minify it for a payload, or find out exactly where the syntax error is, down to the line and column.

Runs entirely in your browser. Your files are never uploaded.

How to use JSON Formatter

  1. 1Paste your JSON into the box.
  2. 2Choose an indent, or minify it instead.
  3. 3Read the error position if it will not parse.
  4. 4Copy the result out.

Your numbers come back unchanged

Most formatters parse JSON into values and print them again. That quietly rewrites every number: 1.0 becomes 1, 1e3 becomes 1000, and an ID like 12345678901234567890 loses its last few digits because a JavaScript number cannot hold it exactly.

This one copies each number through exactly as you typed it, because it re-indents the text rather than rebuilding it from parsed values. String escapes survive the same way, so a \u00e9 stays a \u00e9 instead of turning into an é you did not ask for.

Errors with a position

A parser that says "unexpected token" and nothing else makes you count brackets. This reports the line and the column, and says what it wanted instead: a comma, a closing brace, a value after the colon.

The common ones have their own messages. A trailing comma, single quotes around a key, an unquoted key and an unterminated string are all valid in JavaScript or in JSON5 and none of them are valid JSON, so each gets told apart rather than lumped into one error.

Sorting the keys

Sorting keys alphabetically at every level makes two responses comparable. Run both through with sorting on, then put them side by side in the Text Compare tool, and the differences are the actual differences rather than a reordering by whichever server answered.

Limits

  • Strict JSON only. Comments, trailing commas and single quotes are reported as errors rather than accepted.
  • Nesting is capped at 200 levels, which is far past anything an API returns.
  • Duplicate keys are kept as they are, since removing one would change the data.

Frequently asked questions

Why does my big ID number stay the same here?
Because the text is re-indented rather than parsed into numbers and printed again. A 20-digit ID is beyond what a JavaScript number holds exactly, so any formatter that round-trips through values rounds it. Yours is copied through character for character.
Can it fix JSON with comments or trailing commas?
No, and that is deliberate. Those are JSON5 or JavaScript, not JSON, and silently removing them would hide the fact that whatever produced the file is not producing JSON.
Is my data uploaded to check it?
No. The parser runs in this page, so an API response with customer records in it never leaves your machine. There is no server side to this tool at all.
What indent should I use?
Two spaces is the common default and what most linters expect. Four is easier to read for deeply nested data. Tabs are there for anyone whose editor is set up that way.