How to fix invalid JSON without guessing
A systematic way to locate syntax failures, choose safe repairs, and verify the result.
6 minute read · Updated August 2026Repair JSON locally →Start with the first parser error
JSON parsers often report the place where they became unable to continue, not necessarily the exact character that caused the problem. Read the surrounding line and the preceding value before making a change.
A useful diagnostic includes a stable error code, line, column, and a suggestion. Fix one structural issue, then parse again; later errors are often consequences of the first one.
{
"name": "Ada"
"active": true
}
// missing comma after "Ada"Separate safe normalization from invented intent
Removing a Markdown code fence, accepting a trailing comma, or converting a single-quoted string has a clear mechanical interpretation. Deciding whether a missing token was a comma, a quote, or deleted content may not.
A repair tool should list every operation it applied and stop when the remaining correction is ambiguous.
Validate the repaired data, not just its syntax
After repair, check duplicate keys, unsafe large integers, and any JSON Schema you rely on. Syntactically valid output can still violate the application contract.