Skip to content

JSON Repair

Paste almost-JSON from a log, a chat answer or a JavaScript snippet and get valid JSON back, with a clear report of every change.

Processed locally in your browser

Options
0 chars · 0 lines
The result will appear here.

What is JSON Repair?

Real-world “JSON” is often not valid: JavaScript object literals with single quotes and unquoted keys, Python dictionaries with True/None, output copied with // comments, arrays cut off in the middle, or code wrapped in a Markdown fence. Strict parsers reject all of these.

This tool uses the jsonrepair library to rewrite such input into valid JSON. It never modifies data silently: the original stays in a separate panel, a warning banner tells you that a repair took place, and a report lists the first parse error and the kinds of fixes that were needed. If the text is already valid, it says so and leaves it untouched.

How does it work?

  1. Paste the broken JSON. Example: {a:1,'b':'x',}.
  2. Read the status banner and the report to see what was wrong and what was changed.
  3. Compare with the Original panel and check the values, especially when the input was truncated.
  4. Choose an indentation and copy or download repaired.json.

Common use cases

  • Cleaning a JavaScript object literal copied from source code or a console.log.
  • Rescuing an LLM answer that returned JSON with trailing commas or a code fence.
  • Recovering a JSON file that was truncated by a crashed process or a size limit.
  • Converting Python dict output (single quotes, True, None) into real JSON.

Examples

Try this input in the tool above:

Input
{name: 'Ada', active: True, tags: ['math', 'code',], // a comment
  score: 9.5,
Output
{
  "name": "Ada",
  "active": true,
  "tags": [
    "math",
    "code"
  ],
  "score": 9.5
}

Privacy

JSON Repair runs entirely in your browser. The text or files you provide are processed on your device and are not uploaded, logged or stored on our servers.

Limitations

Repair is a best guess. Missing data cannot be recovered, and ambiguous inputs may be interpreted differently from your intent, so always review the result before using it.

Frequently asked questions

What kinds of problems can be fixed?

Single or curly quotes, unquoted keys, trailing or missing commas, comments, Python constants (True, False, None), NaN/undefined, ellipsis placeholders, unclosed brackets or strings, and Markdown code fences around the JSON.

How can I be sure nothing was changed silently?

The banner turns orange whenever a repair happened, the Original panel keeps your input, and the report lists the first error position plus the categories of fixes. The repaired text is then re-parsed strictly and the result of that check is displayed.

What happens if my JSON is already valid?

The tool tells you it is already valid and only reformats it with the chosen indentation. Nothing else is altered.

More tools in JSON & Data →