About the JSON Fixer
Repair broken JSON automatically. The fixer adds missing quotes and commas, removes trailing commas and comments, converts single quotes, closes brackets, and more.
Key features
- Adds missing quotes around keys and strings
- Converts single quotes and smart quotes
- Removes trailing commas and comments
- Closes unbalanced brackets in truncated JSON
- Converts Python True/False/None
- Pretty-prints the repaired, valid JSON
Repair broken JSON automatically
Invalid JSON comes from everywhere: JavaScript object literals pasted into a config, Python dictionaries printed with print(), hand-edited files, log lines cut off at a character limit, and LLM responses with comments or trailing commas. The JSON Fixer repairs the most common problems in one step and returns clean, valid, formatted JSON.
Before and after
{name: 'Ada', 'age': 36, tags: ['math', 'computing',], // comment
active: True, address: {city: "London"
{
"name": "Ada",
"age": 36,
"tags": ["math", "computing"],
"active": true,
"address": {
"city": "London"
}
}
What gets fixed
| Problem | Example | Fixed to |
|---|---|---|
| Unquoted keys | {name: 1} | {"name": 1} |
| Single quotes | {'a': 'b'} | {"a": "b"} |
| Smart quotes | {“a”: 1} | {"a": 1} |
| Trailing commas | [1, 2,] | [1, 2] |
| Missing commas | {"a": 1 "b": 2} | {"a": 1, "b": 2} |
| Comments | // note, /* x */ | removed |
| Python constants | True, None | true, null |
| Truncated data | {"a": [1, 2 | {"a": [1, 2]} |
| Code fences | ```json … ``` | removed |
When to use the fixer vs. fixing by hand
Use the fixer for syntax problems: quotes, commas, brackets and comments. If the problem is semantic, such as a wrong value or a missing field, the fixer can't know what you meant. Check the result with the JSON Validator and compare it with the original if needed.
Preventing broken JSON
- Generate JSON with a serializer (
JSON.stringify,json.dumps), never by concatenating strings. - Enable JSON validation in your editor.
- In LLM prompts, ask for "valid JSON only, no comments" and use structured output modes where available.
Related tools
Check validity with the JSON Validator; format with the JSON Formatter; fix TOML with the TOML Validator.
How to use the JSON Fixer
- Paste your data into the input box, upload a file, or click Sample to try it out.
- Adjust the options above the editor if you need to (indentation, delimiter, and so on).
- The result appears instantly in the output panel. Any errors are shown with their line and column.
- Click Copy to copy the result, or Download to save it as a file.