Skip to content
TinySolve

JSON Formatter

Format, validate and minify JSON — with the exact line and column of any error.

Runs in your browser — nothing you type is sent anywhere

Your JSON

Result

The formatted result appears here as you type. Nothing is sent anywhere — the parsing happens in this page.

About the JSON Formatter

Most JSON problems are not really formatting problems — they are a single misplaced character somewhere in a few hundred lines. The browser's own error for that is famously unhelpful: "Unexpected token } in JSON at position 412" gives you a character offset in a file you are reading as lines. This formatter turns every parse failure into a line number, a column, the offending line of text, and a caret pointing at the character that broke it.

That matters more than it sounds, because JavaScript engines disagree about what they tell you. Chrome alone throws two different message shapes depending on the error, one carrying a position and one carrying only a quoted excerpt, and Firefox and Safari word theirs differently again. All of them are normalised here so you get the same answer whichever browser you are in.

Pretty-printing supports two, four or tab indentation, and minifying strips every byte of insignificant whitespace — useful when you are pasting a payload into a config field with a size limit. Sorting keys alphabetically makes two versions of the same document comparable in a diff, and it deliberately leaves arrays in their original order, because the order of an array is data rather than presentation.

A byte order mark at the start of a file is stripped before parsing. It is invisible, it is common in files exported from Windows tools, and it otherwise causes a failure at position zero with a message that makes no sense.

Nothing you paste leaves the page. That is the point for this tool in particular: the JSON developers most often need to inspect is a real API response with real tokens, real customer records or real keys in it, and pasting that into a website that round-trips it through a server is a genuine leak.

How to use the JSON Formatter

  1. Paste your JSON

    Drop it into the left panel. It is parsed on every keystroke, so you do not need to press anything to find out whether it is valid.

  2. Read the result or the error

    Valid JSON appears formatted on the right. Invalid JSON shows the message, the line and column, and a caret under the exact character that failed.

  3. Choose how it should look

    Switch between pretty and minified, pick two spaces, four spaces or tabs, and optionally sort every object's keys alphabetically.

  4. Copy or download it

    Copy puts the result on your clipboard; Download saves it as a .json file. Both act on exactly what you see in the result panel.

Frequently asked questions

Why does my JSON say it is invalid when it looks fine?
The usual causes are a trailing comma after the last item, single quotes instead of double quotes, unquoted property names, or a comment — all of which are valid JavaScript but none of which are valid JSON. The error panel points at the exact character so you can see which it is.
Is my JSON uploaded to a server?
No. Parsing and formatting both happen in your browser using the built-in JSON engine, and no request is made. You can confirm it by opening the network tab and pasting something — nothing is sent. That is deliberate, because real payloads usually contain tokens or customer data.
What does minifying actually save?
It removes every space, tab and newline that sits outside a string value. On a typical indented document that is 15–30% of the bytes. Whitespace inside string values is preserved exactly, because that is real data rather than formatting.
Does sorting keys change my data?
No. Object key order is not meaningful in JSON, so sorting produces an equivalent document — which is what makes two versions comparable in a diff. Array order is left untouched, because the position of an item in an array genuinely is part of the data.
Can it handle very large files?
It handles anything your browser can hold in memory, which is normally several megabytes without trouble. Very large documents will make typing feel sluggish, since the whole thing is re-parsed on each keystroke. Deeply nested documents are analysed iteratively rather than recursively, so nesting alone will not crash it.
Are JSON5, JSONC or comments supported?
No, and that is on purpose. This validates against the actual JSON specification, so anything it accepts will be accepted by any parser, and anything it rejects would fail elsewhere too. A tool that quietly accepted comments would tell you a file was fine when your API will reject it.