Results appear here.
Format, validate and repair JSON — it tells you what is wrong, then fixes it and says what it changed.
What this tool does
Paste JSON, get it back formatted or minified. If the JSON is broken, you get a plain-English description of what’s wrong and where — not just the parser’s raw complaint.
Everything runs in your browser. The text you paste is never sent anywhere.
Reading the output
Pretty mode re-indents the document and normalises spacing. Set Indent to 0 to use tab
characters instead of spaces — useful if your project’s linter expects tabs.
Minify mode strips every optional byte. This is what you want before embedding JSON in a data attribute, a query string, or an environment variable.
Sort keys reorders object keys alphabetically, recursively, at every depth. Two configuration
files that differ only in key order will produce byte-identical output once sorted, which makes
diff actually useful. Note that this changes the document: JSON objects are unordered by spec,
but some consumers do care about order, so don’t sort blindly before shipping.
When it says your JSON is invalid
JSON.parse errors are famously unhelpful — the message changed shape three times across V8
versions and never tells you how to fix anything. So this tool scans the source itself and
reports the specific problem:
| What you’ll see | What actually happened |
|---|---|
| 多余的逗号 (trailing comma) | {"a": 1,} — legal in JavaScript, illegal in JSON |
| 单引号 (single quotes) | {'a': 1} — JSON strings must use double quotes |
| 注释 (comments) | // ... or /* ... */ — not part of the JSON spec |
| 键没有加引号 (unquoted key) | {a: 1} — keys must be quoted strings |
| Python 字面量 | True / False / None instead of true / false / null |
| 括号没有闭合 | Counted braces and brackets don’t balance |
The scan skips over string contents, so a comma inside "a,b" or an apostrophe inside
"it's fine" won’t produce a false alarm.
Repairing broken JSON
Switch to Repair and the tool fixes the input instead of rejecting it — trailing commas,
single quotes, unquoted keys, comments, Python literals, missing brackets, and the ```json
fences that language models like to wrap output in.
It also tells you every change it made. That matters more than the repair itself: a tool that silently rewrites your data and hands it back gives you no way to know whether the fix was the one you wanted. If the input was already valid, it says so rather than pretending to have done work.
Repair is most useful on three sources: model output that came back with markdown fences or a truncated tail, config files that are really JSONC, and objects pasted out of JavaScript source.
Escaping and unescaping
Escape turns JSON into a string literal you can paste into source code or another JSON document.
Unescape does the reverse, and is the one people actually need: log lines, database columns and
webhook payloads frequently store JSON inside a string, so you get {\"a\":1} and have to undo
one layer before anything else works.
Common causes
Trailing commas usually come from hand-editing a list and deleting the last entry. Most languages tolerate them; JSON does not. If you control the consumer, consider JSON5 or JSONC instead of fighting this.
Single quotes and unquoted keys mean you’re probably looking at a JavaScript object literal that was copied out of source code, not real JSON. They’re similar but not the same format.
Comments appear in config files — tsconfig.json and VS Code settings are JSONC, which
allows them. Strict JSON parsers will reject those files even though the editor accepts them.
Python literals come from pasting a dict that was printed with print() rather than
serialised with json.dumps().
FAQ
What do the numbers under the output mean?
Size of the formatted result, total key count including nested objects, number of arrays, and how
deeply containers nest. Depth counts containers only — {"a":1} is depth 1, not 2.
Is there a size limit? Input is capped at 5 MB. Larger documents are better handled by a streaming parser than by a browser text area.
Does formatting change my data?
No — unless you enable Sort keys, which reorders object keys. Numbers are re-serialised by
JSON.stringify, so a value written as 1.0 comes back as 1, and integers beyond
Number.MAX_SAFE_INTEGER lose precision. That’s a limitation of JavaScript numbers, not of
this tool.
Are duplicate keys preserved?
No. {"a":1,"a":2} parses to {"a":2} — last one wins, per the JavaScript engine’s behaviour.
If you need to detect duplicates, this tool won’t do it.
Is my data uploaded? No. Open your browser’s DevTools, switch to the Network tab, and format something. You’ll see zero requests.