JSON Repair — Fix Broken JSON
Last updated:
Jsonic's JSON Repair tool automatically fixes the most common JSON errors without requiring manual editing. Paste your broken JSON and click Repair. The tool removes trailing commas, strips JavaScript-style // and /* */ comments, converts Python literals (True → true, False → false, None → null), converts single-quoted strings to double-quoted, and adds missing quotes around unquoted object keys. All processing runs in your browser — your data is never uploaded.
How to repair broken JSON
- Paste your broken JSON into the left panel, or click Example to load a sample with common errors.
- Click Repair.
- The right panel shows the fixed, valid JSON. The center panel lists every fix that was applied.
- If the tool could not repair the JSON automatically, the error message tells you what remains broken.
- Copy the repaired JSON with the Copy button.
FAQ
What errors does JSON Repair fix?
The tool fixes: trailing commas before } or ]; single-line // comments and block /* */ comments; Python literals True, False, and None; JavaScript undefined and NaN; single-quoted strings; and unquoted object keys. These cover the vast majority of JSON found in config files, Python scripts, and API debugging sessions.
Why does my JSON have trailing commas?
Trailing commas are valid in JavaScript, TypeScript, and Python, but not in the JSON specification (RFC 8259). They appear when JSON is copy-pasted from code, or when a developer writes JSON like JavaScript. The repair tool removes them automatically.
What is the difference between JSON Repair and JSON Lint?
JSON Lint (validator) reports errors and their location — it tells you what is wrong but does not fix it. JSON Repair automatically corrects common errors and returns valid JSON. Use Repair first; if it fails, use Lint to pinpoint the remaining structural problem.
Can it fix JSON with Python True, False, and None?
Yes. Python uses capitalized True, False, and None, while JSON requires lowercase true, false, and null. The repair tool replaces them automatically, so you can use Python repr() output directly.
Can it fix single-quoted JSON?
Yes. JSON requires double quotes for strings and keys. The tool converts single-quoted strings to double-quoted strings using a state machine that handles escaped characters correctly.
What if the JSON is too broken to repair?
If automatic repair fails, the tool shows which fixes were applied and the remaining error message. At that point, use the JSON Formatter to identify the structural issue — mismatched brackets, incomplete values, or missing commas between items.
Is my data sent to a server?
No. All repair logic runs entirely in your browser using JavaScript. Your JSON never leaves your machine.
Can it repair JSON with JavaScript comments?
Yes. Both single-line comments (// comment) and block comments (/* comment */) are stripped before parsing. This is common in tsconfig.json, .eslintrc, and other configuration files that allow comments despite being JSON-like.