How to Fix JSON Errors: the 5 Most Common Mistakes
Nine times out of ten a JSON parse error is one of these: a trailing comma, single quotes, unquoted keys, broken escapes or invisible characters. Fix them one by one below, or let the auto-repair tool handle it in one click.
Trailing commas: the number one offender
A comma after the last element is legal in JavaScript objects but illegal in standard JSON, and virtually every parser stops there. The reported position usually points at the closing bracket after the comma; deleting the comma fixes it. The first line above is broken, the second is fixed.
{ "name": "app", "tags": ["a", "b"], }
{ "name": "app", "tags": ["a", "b"] }Single quotes: JSON only accepts double
Data copied out of Python dicts or JS code often carries single quotes. Standard JSON requires double quotes for every string and key. Be careful with bulk find-and-replace when values contain quotes themselves — converting with a lenient parser is safer than hand-editing.
{ 'name': 'app' }
{ "name": "app" }Unquoted key names
JS object literals allow bare keys; JSON does not — every key must be double-quoted. Hand-written config files hit this constantly. If your data really is a JS object literal, use the on-site "JS Object to JSON" tool instead of adding quotes by hand.
{ name: "app", version: 2 }
{ "name": "app", "version": 2 }Broken escapes and invisible characters
Backslashes inside strings must be escaped in pairs and double quotes need a leading backslash. Text copied from Word or web pages can smuggle in curly quotes, non-breaking spaces or zero-width characters — invisible to you, fatal to the parser. When the error says "unexpected character" but the line looks fine, suspect invisible characters and retype that line.
Locating errors: the reported position is not always the cause
Parsers report where they could no longer continue; the real mistake is often earlier — a missing comma on the previous line makes the error point at the next key. Scan backwards from the reported position for the nearest comma, quote or bracket, or paste the whole thing into the homepage workbench: the error line is highlighted with a plain-language explanation and a one-click auto-repair.