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
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.
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
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.
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.
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.
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- JSON Validator
Validate JSON instantly with precise, human-readable error messages and line numbers.
- AI JSON Repair
Fix broken LLM JSON — fences, truncation, unquoted keys, and JS literals. Rule-based today.
- JSON Analyzer & Parser
Analyze JSON structure — depth, key counts, types, and top-level fields at a glance.
- JSON5 Validator & Converter
Validate JSON5 with comments and unquoted keys, then convert to strict JSON.
- JSONL Validator & Formatter
Validate and format JSON Lines — one JSON object per line.
- JWT Decoder
Decode JWT header and payload — inspect claims without verifying signatures.