JSON Repair & Fix

Fix invalid JSON: trailing commas, quotes, unquoted keys, and LLM markdown fences.

  • 100% client-side · your data never leaves your browser
  • Instant, no rate limits
  • Free, no sign-up
Input JSON
Repaired JSON

Your result appears here

Paste JSON into the panel on the left — everything runs privately in your browser.

Overview

JSON Repair — Fix Invalid & Broken JSON Online

Paste broken JSON and get valid, formatted output in one click. JsonDrift's JSON repair tool applies safe, deterministic fixes for the most common causes of parse errors — trailing commas, markdown code fences, single quotes, unquoted keys, and stray characters — then pretty-prints the result. It's the fastest way to fix invalid JSON from ChatGPT and other LLMs, hand-edited config files, or copied log lines, entirely in your browser.

No uploadsNo sign-upOpen source
  1. What JSON errors it fixes

    Most 'Unexpected token' and 'Invalid JSON' errors come from a small, predictable set of mistakes. The repair tool detects and corrects them automatically so you don't have to hunt through thousands of characters by hand.

    • Markdown ```json code fences from LLM output
    • Trailing commas before a closing } or ]
    • Single-quoted 'strings' converted to double quotes
    • Unquoted object keys, e.g. {name: 1} to {"name": 1}
    • Smart / curly quotes pasted from docs and chat
    • Leading prose or explanations wrapped around the JSON
  2. How JSON repair works

    JsonDrift repairs syntax, not meaning. Each pass applies conservative, rule-based transforms that only touch structural characters — quotes, commas, braces, and fences — never your actual values. The cleaned text is then parsed with a strict JSON parser to guarantee the output is valid, and pretty-printed with consistent indentation.

    Because every step is deterministic and runs locally, the same input always produces the same output, and nothing is uploaded to a server — safe for production payloads and secrets.

  3. Fixing JSON from ChatGPT and LLMs

    Large language models frequently wrap JSON in ```json fences, add a sentence of explanation, use single quotes, or leave trailing commas — all of which break JSON.parse(). Paste the raw model response here to strip the noise and recover clean JSON before it reaches your application or API.

    For heavier LLM-specific problems like output truncated by token limits, try the AI JSON Repair tool, which adds prose isolation and truncation recovery on top of these core fixes.

  4. When repair is not enough

    Severely corrupted text or JSON truncated mid-value may still fail to parse — there simply isn't enough information to reconstruct it safely. When that happens, run the input through the JSON Validator to see the exact line and column of the remaining error, then fix it by hand in the JSON Editor.

  5. Repair, validate, and format

    Use JSON Repair to recover broken JSON, the JSON Validator to confirm it is syntactically correct and locate errors, and the JSON Formatter to beautify readable output. Together they cover the full paste, fix, verify, and prettify workflow — all client-side.

FAQ

Frequently asked questions

How do I fix invalid JSON?

Paste it into the tool and it automatically removes trailing commas, code fences, and single quotes, fixes unquoted keys, and returns valid, formatted JSON. If a fix isn't possible, use the validator to find the exact error.

Can it fix JSON from ChatGPT?

Yes. It strips ```json markdown fences, surrounding prose, and single quotes that commonly break JSON copied from ChatGPT, Claude, and other LLMs.

Is this the same as AI JSON Repair?

JSON Repair uses core heuristics. AI JSON Repair adds LLM-oriented steps like prose isolation and truncation recovery, plus an insights panel explaining what changed.

Will repair change my values?

No. Repairs target syntax only — quotes, commas, braces, and fences — not your data values.

Is my JSON uploaded anywhere?

No. All repair logic runs locally in your browser, so sensitive payloads never leave your machine.

Continue with a related tool

All tools

Learn more in our guides

All guides