Skip to content

JSON Repair

Fix trailing commas, single quotes, comments, JSONP wrappers, and more.

Live
Input

What this tool does

The JSON Repair tool turns “almost-JSON” into valid JSON and tells you exactly what it changed. Single quotes, trailing commas, comments, JSONP wrappers, Python True /False / None, JavaScript-style bare object keys, missing commas, BOMs, and other lenient sources all get normalized to strict RFC 8259 JSON. Everything runs in your browser — nothing is uploaded.

How to use it

Paste broken JSON (or load the canonical example), and the right pane fills with the repaired document. The “What we fixed” panel lists every transformation that ran — each fix is conservative and never touches your data, only its syntax. Click Apply to inputto copy the repaired text into the input box so you can save it.

Input (a typical messy paste):

{foo: 'bar', items: [1, 2,], ok: True, /* note */ ratio: .5}

Output:

{
  "foo": "bar",
  "items": [1, 2],
  "ok": true,
  "ratio": 0.5
}

Fixes applied (in order): bare keys quoted, single quotes converted,trailing comma removed, Python literal replaced, comments stripped,leading-dot number normalized.

Limits and edge cases

  • Repair is a heuristic, not a full JSON5 or JSONC parser. It handles the common cases listed above; deeply broken or truncated input may not be recoverable.
  • It only changes syntax — never values. Numbers stay as numbers, strings stay as strings, and the document structure is preserved.
  • Ambiguous cases (e.g. NaN / undefined / unterminated strings) are left as-is. If the residual output still doesn’t parse, the “residual error” banner points at the line and column where the parser gave up — you can then patch by hand and run the Validator to confirm.
  • The original input stays in the editor on the left until you click Apply to input. Repair is non-destructive.
  • Background reading: common JSON syntax errors explains why these mistakes happen so often, and parsing JSON safely in JavaScript covers how to handle untrusted input.

Frequently asked questions

Does it fix every kind of broken JSON?
It handles the common cases: BOMs, JSONP wrappers, // and /* */ comments, single quotes, trailing commas, missing commas between members on separate lines, JavaScript-style bare keys, Python True/False/None, and leading-dot numbers like .5. It does NOT recover from truncated data or fundamentally malformed structure (e.g. mismatched braces).
Will the repair change my data?
No. Repair only normalizes syntax — it never alters values. Numbers, strings, booleans, and nulls round-trip unchanged; objects and arrays keep their members and order. If you spot a value-level change, that's a bug — please report it.
Can I undo a repair?
Yes — repair is non-destructive. The original text stays in the input pane on the left. The repaired text is only copied across when you click 'Apply to input'. Browsers keep their normal undo history for the input editor, too.
Does it support JSON5 or JSONC?
It handles a useful subset of JSON5 and JSONC (comments, trailing commas, single quotes, unquoted keys, leading-dot numbers) but is not a full implementation. For round-tripping JSON5 or JSONC documents, use a dedicated library.
What if the repaired output still isn't valid?
The Repair panel shows a residual error banner pointing at the line and column where the parser gave up. Apply the listed fixes, edit the input by hand to address the residual issue, and run the Validator for a clean bill of health.
Is my JSON sent to a server?
No. Every fix runs in your browser; the page never uploads your data.