JSON Repair

Fix malformed JSON from LLMs, logs and hand-edited files in one click.

Language models frequently return almost-JSON: the object is wrapped in a markdown code fence, prefixed with a sentence of explanation, written with single quotes or Python's True and None, or cut off when the response hit its token limit. Logs and hand-edited config files have the same problems with trailing commas and comments.

JSON Repair extracts the JSON from the surrounding text and fixes these issues, closing any brackets and strings that were left open. The result is strict JSON that any parser accepts. Always review a repaired document that was truncated, because the missing tail cannot be recovered.

How to use it

  1. Paste the broken JSON or the raw model response into the editor.
  2. Press Repair. The corrected document replaces the text and the status turns to Valid JSON.
  3. Review the result, then format, copy or convert it.

Questions

What kinds of errors can be repaired?

Markdown code fences and surrounding prose, missing or trailing commas, single or curly quotes, unquoted keys, comments, Python and JavaScript literals (True, False, None, undefined), concatenated strings, and unclosed strings, arrays and objects.

Why does LLM output break JSON parsers?

Models generate text token by token and are not constrained to the JSON grammar unless structured output is enabled. They may add explanations, use the syntax of another language, or stop before the closing bracket when max tokens is reached.

Is repair safe to use in production?

Repair is a best-effort recovery, ideal for debugging and one-off fixes. For production pipelines prefer the provider's structured-output or tool-calling mode and validate the result against a JSON Schema.

All tools