Wasim's Site

Fix JSON

Repair broken or invalid JSON — trailing commas, single quotes, comments, unquoted keys, Python literals — then format it.

Couldn't fully repair: Expected double-quoted property name in JSON at position 81 (line 7 column 3)

Fixes the common breakages — trailing commas, single quotes, unquoted keys, // and /* */ comments, Python-style True/False/None, and smart quotes. It's a best-effort cleaner; always review the output.

Repair broken JSON

JSON.parse is strict: one trailing comma, a single quote, or a stray comment and the whole thing fails. This tool cleans up those common mistakes and gives you valid, formatted JSON back. Paste your data, and the fixed result appears instantly — everything runs locally in your browser.

What it fixes

  • Trailing commas ([1, 2, 3,][1, 2, 3])
  • Single-quoted strings and keys ({'a': 'b'}{"a": "b"})
  • Unquoted object keys ({name: 1}{"name": 1})
  • // line and /* */ block comments
  • Python/JS literals: True, False, None, NaN, undefined
  • Smart / curly quotes (“ ” ‘ ’)

Need to format already-valid JSON, or work with JSONL? Try the JSON Prettifier.

Frequently Asked Questions

What kinds of problems does it fix?
Trailing commas, single-quoted strings and keys, unquoted object keys, // and /* */ comments, smart/curly quotes, and Python/JS literals like True, False, None, NaN and undefined. After cleaning, it validates and pretty-prints the result.
Is it guaranteed to fix any JSON?
No. It is a pragmatic, best-effort cleaner that handles the most common breakages. Structural problems (missing brackets, missing commas between values) may not be auto-fixable — in that case it shows the cleaned text and the exact parse error so you can finish by hand.
Does my data get uploaded?
No. The repair runs entirely in your browser; your JSON never leaves your device.
How is this different from a JSON formatter?
A formatter only re-indents already-valid JSON. This tool first repairs invalid JSON (the kind JSON.parse rejects), then formats it. For valid JSON it simply pretty-prints.