JSON Fixer

Auto-repair malformed JSON — single quotes, trailing commas, JS comments, undefined, and Python literals.

What This Tool Fixes

ProblemInputFixed Output
Trailing commas{"a": 1,}{"a": 1}
Single quotes{'a': 'b'}{"a": "b"}
undefined values{"x": undefined}{"x": null}
Python None{"val": None}{"val": null}
Python True/False{"ok": True}{"ok": true}
JS // comments// title {"a": 1}{"a": 1}
JS /* */ comments/* note */ {"a": 1}{"a": 1}
BOM character{"a": 1}{"a": 1}

Limitations

The fixer handles common patterns but cannot repair all malformed JSON. If the output still fails to parse, use the JSON Validator to see the exact error location and fix it manually.

Complex cases not handled: deeply escaped strings, hex escape sequences, multi-line string values, or truncated/incomplete JSON.

Common JSON Errors and Their Fixes

json
// Before fixing (JavaScript object literal, not valid JSON):
{
  // User profile
  name: 'Alice',         // unquoted key, single quotes
  active: True,          // Python boolean
  score: undefined,      // JS undefined
  tags: ['a', 'b',],    // trailing comma
}

// After fixing:
{
  "name": "Alice",
  "active": true,
  "score": null,
  "tags": ["a", "b"]
}

Frequently Asked Questions

JavaScript object literals use single quotes, but JSON requires double quotes. This happens when copying from browser devtools, Python dicts, or config files.

Modern JS (and TypeScript, JSON5) allows trailing commas for cleaner diffs. Standard JSON parsers reject them, but this tool removes them automatically.

A yellow warning message shows what the tool could not fix. The partially-fixed output is shown so you can see how far it got and fix the rest manually.

No — truncated or incomplete JSON (missing closing brackets, cut-off mid-string) cannot be repaired automatically because the missing content is unknown.

This tool handles the most common JSON5 features (comments, trailing commas, single quotes) but not all of them (template literals, hex numbers, etc.).

Related Tools