JSON Repair

Fix broken JSON: quotes, trailing commas, comments and truncated LLM output.

How to use the JSON repair tool

  1. Paste the broken JSON into the left box. It can be a whole chat answer from an LLM, a JavaScript object literal or a config snippet.
  2. The repaired, valid JSON appears on the right as you type.
  3. Pick an indent of 2 spaces, 4 spaces or tabs, or Minify to get the result on one line.
  4. Select Copy to copy the result. The status line tells you whether anything had to be fixed.

Example

Language models often wrap JSON in a Markdown fence, add comments and stop half way. This input:

```json
{
  // generated profile
  name: 'Ada', tags: ['math', 'code',],
  active: True,
  "bio": "First programmer

is repaired to:

{
  "name": "Ada",
  "tags": [
    "math",
    "code"
  ],
  "active": true,
  "bio": "First programmer"
}

What gets fixed

  • Markdown code fences such as ```json, with any text before or after them.
  • Single quotes and curly quotes around strings, and unquoted property names.
  • Trailing commas, missing commas and // or /* */ comments.
  • Python literals True, False and None.
  • Truncated output: unterminated strings and missing closing brackets are completed.

Frequently asked questions

Why does LLM output break JSON?

Models generate text token by token, so they sometimes mix in JavaScript habits like single quotes and comments, wrap the answer in Markdown, or hit a token limit before the closing brackets. Repairing the text is often quicker than asking the model again.

Can the repair change my data?

The repair only adds or replaces syntax: quotes, commas and brackets. When the input is truncated the missing end is closed, not guessed, so check that the last values are complete. If the input was already valid JSON, it is only reformatted and the status says so.

Is my JSON sent anywhere?

No. Repairing runs in your browser with the open-source jsonrepair library. Nothing you paste is uploaded or stored. To check or format JSON that is already valid, use theJSON formatter.