JSON formatter
Pretty-print, minify, and validate JSON — with the parse error's line and column.
This runs in your browser. Nothing is uploaded.
About JSON formatter
Pretty-prints, minifies, and validates JSON in your browser, and points at the line and column of a parse error so you can fix it without uploading the document.
JSON is easy to produce and surprisingly easy to break. A trailing comma from a Python dict, a comment you left in from a config file, a smart quote that crept in from a document, or a missing bracket three hundred lines down — any of those will make JSON.parse throw, and most formatters respond by dumping the whole payload into a textarea on someone else's server so their parser can tell you what you already suspected.
This page runs the parser in your tab. Paste or type, and if the document is valid it pretty-prints with two-space indent, or minifies to a single line. If it is not valid, the error message includes the engine's position plus a line and column so you can jump there instead of staring at a wall of text. The file never leaves the machine, which is the point when the JSON is an export of users, tokens, or a private API response.
I did not add a schema validator, a tree view, or a foldable outline. Those belong in an editor. This is the formatter I want when a colleague pastes a blob in chat and I need to see it, or when a minified log line has to go back into a config. Switch Pretty and Minify as you like; both paths parse first, so minify will not silently emit broken output.
How to use JSON formatter
- 1Paste JSON into the panel, or load a .json file from disk.
- 2Leave Pretty selected to indent it, or switch to Minify for a single line.
- 3If a parse error appears, use the line and column to fix the source and paste again.
- 4Copy the result when you want it on the clipboard.
What it won't do
- Comments and trailing commas are rejected — they are not JSON.
- There is no schema check, JSONL mode, or JSON5 support.
Common questions
Why does the JSON formatter show a line and column instead of just 'invalid'?
Because 'invalid JSON' is not a fix. The JavaScript parser reports a character offset; this page turns that offset into a line and column so you can find the trailing comma or the unquoted key without counting characters by hand.
Does pretty-printing JSON change the data?
No. JSON.parse then JSON.stringify round-trips objects, arrays, strings, numbers, booleans and null. Key order follows what the engine parsed. You will lose comments and trailing commas, because those are not JSON — they were why it failed to parse in the first place.
Can I format a JSON file that contains passwords or tokens?
Yes, and that is why this exists. The document is parsed in the page's memory. There is no request, no pastebin, and no log. Close the tab and it is gone. I still would not paste production secrets into a random website that claims the same thing without showing you the network panel.
What is the largest JSON document this will format?
Whatever this tab can hold. A few megabytes of pretty-printed JSON is fine on a laptop. Tens of megabytes will hitch the page while stringify walks the tree, because this is the main thread, not a streaming formatter. Split huge dumps first.
Related tools
Why this one doesn't upload your file
There is no server to upload to. This page is a static file, and the work happens in your browser using the same graphics and WebAssembly code that renders every other site you visit. Your file is read from disk into memory, processed, and handed back as a download. Once the page has loaded you can disconnect from the network entirely and it keeps working. The longer explanation