JSON Formatter

Pretty-print, validate and minify JSON. When a document is invalid, the error names the exact line and column instead of just saying "no". Everything runs in this browser tab — nothing is uploaded.

JSON input

Paste a response body, a config file or anything else that should be valid JSON.
Validation runs against the JSON spec as implemented by your browser. You text is kept in this browser only, so it survives a reload.

Output

Formatted JSON will appear here.

Format adds two-space indentation; Minify strips every byte of whitespace that is not required.

Private by design. This page has no backend. Your JSON is parsed and pretty-printed by JavaScript running on your own device and is never sent anywhere.

How the parser works

Your document is handed to the browser's native JSON.parse. That is the JSON spec, in code that ships with every browser, so it accepts exactly what JSON allows and rejects exactly what it does not — including trailing commas, comments, and bare quotes inside a string.

Where errors point

When JSON.parse throws, the message from the engine usually names the character offset. This tool turns that offset into a line and column number, so a missing comma on line 14 is not a treasure hunt.

Pretty-printing

Formatting re-serialises the parsed value with two-space indentation. Numbers and their strings are produced by the engine, so 0.10 round-trips as you typed it and Unicode escapes are kept as the engine stores them.

Minifying

Minify does the same re-serialisation but without a single space or newline, which is the smallest form the same value can take. If all you need is a valid format, Minify is the safest choice — it can never change the meaning of your data.

Common uses

Cleaning up an API response before sharing it, checking a config file is well-formed after a hand edit, and shrinking a file before it goes into a bundle or a database column.

How to use the JSON Formatter

  1. Paste your JSON into the input box.
  2. Choose to format, minify or validate it.
  3. Fix any error the tool points to, then copy the result.

Frequently asked questions

Does it point out where the JSON is broken?

Yes. Parse errors are reported with the line and column of the problem.

Can it minify as well as pretty-print?

Yes. Format adds indentation, while minify strips all unnecessary whitespace.

Is my JSON uploaded?

No. Parsing and formatting happen in your browser.