JSON Repair

Paste broken JSON — trailing commas, single quotes, unquoted keys, comments, truncated arrays. We try to repair it in your browser and show you exactly what changed.

What it fixes

  • • Trailing commas after the last item in an object or array
  • • Single-quoted strings and unquoted object keys
  • • JavaScript-style // and /* */ comments
  • • Truncated or unterminated arrays and objects, where the closing brackets are inferred
  • • Before / after diff, so you can verify exactly what was changed before you trust the result

Example: "almost valid" JSON

This is the kind of output that commonly comes back from an LLM or a hand-edited config — technically invalid JSON, but close enough that a human can tell what was meant:

{
  name: 'Ada Lovelace',
  roles: ['admin', 'editor',],
  // added this year
  active: true,
}

JSON Repair normalizes the unquoted key and single-quoted strings, drops the trailing comma and the comment, and outputs valid JSON with a diff highlighting each change.

Why this comes up so often

LLM responses that are supposed to be JSON frequently include trailing commas, stray commentary, or get cut off mid-array when a response is truncated. Hand-written config files often use JavaScript object literal syntax instead of strict JSON. JSON Repair targets exactly these "almost valid" cases — it's not a general-purpose JSON5 parser, but it covers the patterns that show up in practice. We never see your data — your tokens stay yours; repair runs entirely in your browser.

After it's repaired

Once your JSON is valid, open it in the JSON Viewer to browse it as a tree, or in JSON Diff to compare it against a known-good version.

FAQ

Can it fix any broken JSON?

It targets the most common real-world issues — trailing commas, unquoted keys, single quotes, comments, and truncated structures. Severely malformed input may not be recoverable automatically, but the before/after diff always shows exactly what was changed so you can sanity-check the result.

Is my data sent to a server to be repaired?

No — We never see your data. Repair logic runs locally in your browser.

Does it work well on LLM output?

Yes, that's one of the primary use cases — LLM responses that are meant to be JSON but include trailing commas or get truncated mid-structure.

Related tools