The Five Faults Behind Most Broken JSON
- Trailing comma —
{"a": 1,}or[1, 2,]. Delete the comma before the closing bracket. - Single quotes —
{'a': 1}. Replace every'around keys and string values with". - Unquoted key —
{a: 1}. Wrap the key in double quotes. - Comment —
// noteor/* note */. Remove it, or switch the file to JSONC, JSON5, or YAML. - Unclosed bracket or quote — reported as an unexpected end of input. Count openers against closers from the reported line upward.
Repair Workflow
- Paste the broken JSON. Note the reported line and column.
- Fix that one character. Do not fix ahead — a parser stops at the first fault, so later errors are still hidden.
- The check re-runs as you type. Repeat until the status reads valid.
- Send the repaired document through the JSON Formatter to normalise indentation.
Smart Quotes and Invisible Characters
Text copied out of a word processor, a chat client, or a PDF often carries typographic quotes (“ and ”) that look correct but are not U+0022. A byte-order mark at the start of a file and a non-breaking space between tokens fail the same way. When the reported column looks like it points at valid text, one of these is usually why.
Who this guide is for
- Repair a config file after a hand edit introduced a trailing comma
- Diagnose a payload truncated by a network timeout
- Fix JSON copied out of a document that replaced quotes with smart quotes
- Locate the unclosed bracket in a deeply nested file