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.

Paste your JSON
1
Waiting for input…

        
        
    

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 literalsNone, True, False are replaced with null, true, false.
  • JavaScript/Python comments// line and /* 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. \uXXXX with non-hex characters.

Common sources of broken JSON

  • Python dict output — Python's print(dict) uses True/False/None and 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.

Frequently asked questions

Use JSON Validator when you want to know whether your JSON is valid and get detailed error information. Use JSON Repair when you already know it is broken (or suspect it is) and want to fix it automatically. If you are not sure, start with the Validator to see the exact error, then use Repair if the error is one of the common types it handles.

The repair engine applies fixes conservatively and validates the result after every repair attempt. If the repaired output does not parse as valid JSON, it reports failure rather than returning a potentially wrong result. However, for ambiguous cases (like Python dict with mixed quotes), the output should always be reviewed before use.

Yes, within browser memory limits. Files under a few megabytes repair instantly. For very large files, consider using a CLI tool like jq with the --rawfile flag, or a Python script with json.loads() inside a try/except.

Yes. JSON does not support comments, so to produce valid JSON the comments must be removed. If you need to keep comments, your file is JSONC or JSON5 — format it with a tool that supports those formats instead.