Eazy Toolbox
Skip to tool

JSON Formatter

Paste JSON to pretty-print it with consistent indentation, or minify it back down. Invalid JSON is reported with the exact line and column so you can find the problem.

Your data never leaves your browser. This tool runs entirely on your device.

Result
Nothing to format — paste some JSON first.

How it works

The formatter parses your input with the browser's own JSON parser and re-serialises it with the indentation you choose. Because it is a full parse rather than a text transformation, anything that comes out the other side is guaranteed to be valid JSON.

That round trip also normalises the document: key order is preserved, but whitespace, escape sequences and number formatting are rewritten canonically. If the parse fails, nothing is emitted and you get the position of the first syntax error instead.

What counts as invalid JSON

JSON is stricter than JavaScript object syntax, and the same handful of mistakes account for most errors:

  • Trailing commas after the last element of an object or array.
  • Single quotes instead of double quotes around strings and keys.
  • Unquoted keys, which are legal in JavaScript but not in JSON.
  • Comments — JSON has no comment syntax at all.
  • Special values like NaN, Infinity or undefined.
  • A literal newline inside a string, which must be escaped as \n.

Privacy

The tool runs entirely in your browser. Your JSON is never sent to a server, never logged and never stored, which means it is safe to paste API responses containing production data.

Frequently asked questions

Is my JSON uploaded anywhere?

No. Formatting happens in your browser using its built-in JSON parser. The page makes no network request with your content, so you can safely paste sensitive payloads.

Why does my JSON fail with a trailing comma?

JSON does not allow a comma after the final element of an object or array, even though JavaScript does. Remove the comma before the closing brace or bracket.

Should I use 2 spaces, 4 spaces or tabs?

It is a style choice with no effect on validity. Two spaces is the most common convention for JSON config files and keeps deeply nested documents narrow; tabs are preferred when readers need to control indentation width themselves.

Does formatting change my data?

No values change, but the text representation is normalised: whitespace is rewritten, and numbers are re-serialised in their canonical form. Very large integers beyond 2^53 can lose precision, because JavaScript parses all JSON numbers as doubles.

What is the difference between formatting and minifying?

Formatting adds newlines and indentation so a human can read the structure. Minifying removes every optional character to make the payload as small as possible for transmission. Both produce equivalent JSON.