Kit — JSON formatter
JSON formatter and validator
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.
The formatted output will appear here.
This runs entirely in your browser. Nothing is uploaded.
Related tools
What this one gets right
Browser error messages often carry no position at all — Chrome returns a snippet instead once the input is any real length, and Safari never gives one. This page follows the syntax itself to find the spot, then quotes the line with a caret under the character. Minified JSON — one line, megabytes long — is windowed around the error instead of dumped.
Trailing commas, single quotes, unquoted keys, comments, curly quotes and ideographic spaces from a CJK keyboard. Every one of them is a habit from JavaScript or from a text editor, and "Unexpected token" explains none of them. Whatever is found gets named.
Most things pasted into a JSON formatter are API responses, and API responses carry bearer tokens, e-mail addresses and order history. Everything here happens in the page; nothing is sent anywhere.
Worth knowing
Questions
Is the JSON I paste uploaded?
No. Parsing, formatting and validation all happen in the page, with no network request involved. 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 also mangles every apostrophe inside a string. Showing you where and why is safer than silently rewriting your data.
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.