JSON Repair
Paste broken or invalid JSON. The tool attempts to auto-fix it — if it can't, the exact error line is highlighted so you can fix it manually.
What is JSON repair?
JSON repair is the process of automatically fixing common syntax errors in a JSON string so that it parses correctly. When you copy JSON from a browser console, Python script output, a log file, or a language model, the result often contains minor syntax issues that prevent standard parsers from reading it. Rather than manually hunting for the offending character, a repair tool detects and corrects the most common patterns automatically.
This tool works entirely in your browser — your data is never sent to a server. It applies a series of fixes in sequence, then attempts to parse the result. If repair succeeds, the corrected JSON is displayed alongside a list of every fix applied. If it cannot repair the JSON, it highlights the exact error line so you can fix it manually.
What errors can be automatically repaired?
- Trailing commas —
{"a":1,}— the trailing comma before a closing bracket is removed. - Single-quoted strings —
{'key':'value'}— single quotes are replaced with double quotes. - Unquoted object keys —
{key:"value"}— unquoted keys are wrapped in double quotes. - Python literals —
None,True,Falseare replaced withnull,true,false. - JavaScript/Python comments —
// lineand/* block */comments are stripped. - Unclosed brackets or braces — the tool tracks the bracket stack and appends any missing closing characters at the end.
What errors cannot be auto-repaired?
Some errors require human judgement and cannot be safely repaired automatically. If the repair fails, the tool highlights the exact error line so you can fix it manually. Common non-auto-repairable issues include:
- Duplicate keys — which value should be kept is ambiguous.
- Completely malformed or truncated JSON — if the structure is too broken to guess intent.
- Mixed-up bracket types mid-structure — e.g. opening
[closed with}deep in a large structure. - Invalid Unicode escape sequences — e.g.
\uXXXXwith non-hex characters.
Common sources of broken JSON
- Python dict output — Python's
print(dict)usesTrue/False/Noneand single quotes, which are not valid JSON. - Copy-pasted from logs — log formatters sometimes truncate lines or add timestamps that break JSON structure.
- AI/LLM output — language models often generate JSON-like responses with trailing commas, single quotes, or JavaScript-style comments embedded.
- Config files (JSONC/JSON5) — VS Code config files, tsconfig.json, and similar use comment syntax that strict JSON does not allow.
- Hand-written JSON — trailing commas after copy-pasting blocks are a common human error.