What is JSON repair?
JSON repair turns malformed or non-standard JSON-like text into strict, parseable JSON. It can correct common syntax problems such as single quotes, unquoted object keys, missing commas, trailing commas, comments, and missing closing brackets.
This is different from validation. A validator reports why a document is invalid, while a repair tool attempts to produce a corrected result. The repaired output is checked again as strict JSON and formatted with two-space indentation.
Repair is heuristic. A parseable result does not prove that its values or structure match the data you intended.
How to repair JSON online
- Paste JSON-like text into the input editor, open a local
.jsonor.txtfile, or select Example. - Select Repair JSON, or press Cmd + Enter on macOS and Ctrl + Enter on Windows or Linux.
- Review the strict JSON result, then copy it or download
repaired.json.
If the input is already valid JSON, the tool formats it without applying a syntax repair. If the input cannot be repaired safely, it keeps the original text and reports a diagnostic instead of creating an unverified result.
JSON repair example
Input:
{
project: 'Bitty Coder',
active: True,
tags: ['json', 'repair',],
}
Repaired output:
{
"project": "Bitty Coder",
"active": true,
"tags": [
"json",
"repair"
]
}
This example adds quotes around keys, converts single-quoted strings and the Python constant True, and removes trailing commas.
Common JSON errors this tool can fix
| Problem | Example |
|---|---|
| Single quotes | {'name': 'Ada'} |
| Unquoted object keys | {name: "Ada"} |
| Missing or trailing commas | {"a": 1 "b": 2} or {"a": 1,} |
| Missing closing brackets | {"items": [1, 2 |
| JavaScript comments | {"active": true /* enabled */} |
| Python constants | {"active": True, "value": None} |
| Smart quotes and special whitespace | {“name”: “Ada”} |
| Markdown code fences | ```json {"active": true} ``` |
| Truncated objects and arrays | {"user": {"name": "Ada" |
| Newline-delimited JSON | Separate JSON objects on consecutive lines |
Some repairs are straightforward, such as removing a trailing comma. Others require an inference, such as deciding where a truncated container should close. Always review important data after repair.
Repairing AI-generated JSON
AI tools sometimes wrap JSON in Markdown code fences, use JavaScript-style object syntax, mix in comments, or stop before every object and array is closed. JSON Repair can correct these syntax patterns when the intended structure can be inferred.
It does not use AI to invent missing fields or values. If an AI response was truncated before important data was generated, closing the remaining brackets can make the document valid but cannot restore the lost content.
JSON repair vs validator vs formatter
| Tool | Primary purpose |
|---|---|
| JSON Repair | Correct common malformed or non-standard JSON and produce strict JSON. |
| JSON Validator | Check strict JSON syntax and report errors without changing the source. |
| JSON Formatter | Add consistent indentation to JSON that is already valid. |
Repair includes strict validation and two-space formatting as part of its output. Use the dedicated validator when you do not want automatic changes. Use the formatter when the document is already valid and you need indentation options or token-preserving formatting controls.
For important changes, you can compare the original and repaired documents with JSON Diff after checking that both represent the data you expect.
What JSON repair cannot fix
JSON Repair cannot determine a missing field’s correct value, validate business rules, verify a document against a JSON Schema, or guarantee the meaning of ambiguous input. It also cannot recover content that was never present in a truncated document.
Severely incomplete, contradictory, or non-data input may not be repairable. In those cases, preserving the input and reporting failure is safer than guessing.
JSON repair FAQ
What is the difference between JSON Repair and JSON Validator?
JSON Repair changes common invalid syntax and returns a strict JSON result. A validator only checks the source and reports errors.
Can this tool fix every broken JSON document?
No. It can repair common and reasonably inferable syntax problems, but severely damaged or ambiguous input may not have one safe correction.
Can it repair JSON generated by ChatGPT or other AI tools?
It can remove Markdown code fences and repair common quote, comma, comment, and closing-bracket problems. It cannot reconstruct fields or values that the model never generated.
Can it convert Python True, False, and None?
Yes. These constants are converted to the JSON values true, false, and null.
Is repaired JSON guaranteed to preserve the original meaning?
No. The result is guaranteed to pass strict syntax validation when repair succeeds, but inferred punctuation or structure may not match the author’s intent.
Can truncated JSON be fully recovered?
Only the remaining structure can sometimes be closed. Any text, fields, or values missing from the original input cannot be recreated.