dilettanteee
tools/developer-utilities/json-formatter

JSON Formatter

Pretty-print, minify, and catch syntax errors with line numbers.

Indent
Input
Output

Formatted JSON appears here.

About JSON Formatter

The JSON Formatter turns a dense or minified JSON blob into readable, indented text, or does the reverse and squeezes it onto one line. It also checks the syntax as you go, so it doubles as a quick validator when an API response or config file refuses to parse.

How to use it

  1. Paste your JSON into the input panel.
  2. Pick an indent of 2 spaces, 4 spaces or a tab, or switch on Minify to strip all whitespace.
  3. Turn on Sort keys if you want object keys arranged alphabetically, which makes two versions much easier to compare.
  4. Copy the formatted result from the output panel.

Good to know

  • If the JSON is invalid, the tool reports the line and column of the first syntax error so you can jump straight to it.
  • Strict JSON does not allow comments, single-quoted strings or trailing commas. Those are the most common reasons a file that looks fine still fails to parse.
  • Formatting only changes whitespace and, if you ask for it, key order. The data itself is never altered.

Common questions

Is the JSON I paste sent anywhere?

No. Formatting and validation run in your browser, so the text never leaves your device.

What does Sort keys do to arrays?

Keys inside every object are sorted alphabetically, including nested ones. Arrays keep their original order, because the order of items in an array often carries meaning.