Skip to content

JSON Formatter

Paste JSON

The formatted output will appear here.

Paste JSON to pretty-print, minify or sort its keys. When it does not parse, you get the line and column, the offending line quoted with a caret under it, and a plain-language note about trailing commas, comments and the other things JSON quietly forbids.

Formats

JSON

Questions

Is the JSON I paste uploaded?

No. Parsing, formatting and validation all happen in the page, and what you paste is never sent to a server. Close the tab and it is gone.

How large an input can it handle?

No hard limit — it depends on your device. A few megabytes is comfortable. Above roughly 200KB the live formatting switches off and a Format button appears, because re-parsing several megabytes on every keystroke makes typing itself stutter.

Will it repair broken JSON for me?

No. Deleting a trailing comma would be safe, but swapping single quotes for double quotes can also mangle apostrophes inside strings. Instead of rewriting anything automatically, it shows the position and the reason.

Does the line number come from the browser?

No — leaving it to the browser is why most formatters cannot show one. Chrome returns a snippet instead of a position once the input is any real length, and Safari never includes one. So this page walks the syntax itself to find where the document first breaks, and counts the line and column from there. The explanation ("nothing follows this comma") comes from the same pass; the browser’s own wording is kept below for reference. The formatting is still done by the browser’s standard parser, so the output matches how JSON is read everywhere else.

What is sorting keys good for?

Stable diffs. Two files with identical content but different key order produce noise in a comparison; sort both first and only the real differences remain. The order is Unicode code-unit order, so it is the same on every machine.

Sponsored links