JSON looks close enough to a JavaScript object literal that it's easy to assume the same rules apply — they don't. The JSON spec is much stricter, and most "why won't this parse" moments come down to one of a small set of mistakes. Here's what to look for, roughly in order of how often each one shows up.
First, read the error message
A JSON parser's error message is more useful than it looks. A typical JSON.parse failure reads something like Unexpected token '}', ..."b": 2,} is not valid JSON — it names the character it choked on and its position in the string. Our JSON Validator takes that raw character position and converts it into an actual line and column, so instead of counting characters by hand you can jump straight to the problem.
1. Trailing commas
The single most common one. This is invalid:
{
"name": "Ada",
"role": "Engineer",
}That comma after "Engineer" has no field following it, and JSON doesn't allow a trailing comma the way a JS object literal does. Same rule applies to arrays: ["a", "b",] is invalid. Delete the last comma in the object or array.
2. Single quotes instead of double quotes
{'name': 'Ada'} is valid JavaScript, not valid JSON. Every string — keys included — must use double quotes. There's no configuration flag or JSON "mode" that allows single quotes; if a system produced single-quoted output, it wasn't actually emitting JSON.
3. Unquoted keys
{name: "Ada"} — another JS-object-literal habit that doesn't carry over. Every key needs double quotes: {"name": "Ada"}.
4. Mismatched or missing brackets
An extra closing }, a missing closing ], or a brace that closes an array instead of an object — these usually happen when editing JSON by hand and losing track of nesting depth. The parser will point at wherever it noticed things went wrong, which is sometimes a line or two after the actual mistake, since it doesn't know your object was supposed to end sooner until it hits something that doesn't fit. If the reported line looks fine, check the few lines above it first.
5. Bad escapes and literal control characters inside strings
Inside a JSON string, a backslash always starts an escape sequence — a lone \ that isn't followed by one of " \\ / b f n r t or a u0000-style unicode escape is invalid. This bites people most often with Windows file paths (C:\Users\name needs to become C:\\Users\\name) and regex patterns pasted straight into a JSON string. Also invalid: a literal, unescaped newline or tab character inside a string — those need to be written as \n and \t instead of an actual line break.
6. Duplicate keys
{"role": "Engineer", "role": "Manager"} is technically not a syntax error — most parsers accept it and silently keep the last value, discarding the first. That's arguably worse than a hard error, since nothing warns you a field got overwritten. If a value looks wrong after editing, search the document for the key name to check it isn't defined twice.
7. NaN, Infinity, and undefined aren't valid JSON
These are legal in JavaScript but have no representation in JSON — NaN, Infinity, -Infinity, and undefined will all fail to parse if they show up as a bare value. This typically happens when JavaScript code calls JSON.stringify on a value containing one of these — it silently converts them to null rather than erroring, which can be a surprise if you were expecting the number to survive the round trip.
8. A stray character at the very start
If a document fails to parse at position 0 and looks completely valid to the eye, check for an invisible byte-order-mark (BOM) or a leading space copied in from another application. Pasting into a plain-text validator usually makes an otherwise invisible character visible as an unexpected token right at the start.
Fixing it once you've found it
After the error is located, paste the corrected document into our JSON Formatter to re-indent it and confirm it now parses cleanly. If you're trying to figure out what changed between a working version and a broken one, JSON Diff compares two documents by path and ignores formatting, so it surfaces the actual value that moved or disappeared instead of a wall of whitespace noise.
Try it yourself
Paste any JSON into our JSON Validator to get the exact line and column of the first syntax error. Like every tool on this site, validation happens entirely in your browser — nothing is uploaded anywhere.