Common JSON errors and how to fix them
JSON is strict. A single misplaced comma or quote breaks the whole document. Here are the errors people hit most often, why they happen, and how to fix each one.
Paste your JSON into the validator →On this page
1. Trailing commas
The most common JSON mistake by far. A comma after the last item in an object or array is allowed in JavaScript, but not in JSON.
Invalid{
"name": "duval",
"tags": ["fast", "private",]
}
Valid
{
"name": "duval",
"tags": ["fast", "private"]
}
Remove the comma before any closing } or ].
2. Single quotes instead of double
JSON strings and keys must use double quotes. Single quotes are valid in JavaScript but rejected by every JSON parser.
Invalid{ 'city': 'Istanbul' }
Valid
{ "city": "Istanbul" }
3. Unquoted keys
Every key (property name) must be wrapped in double quotes. Object literals in JavaScript let you skip the quotes; JSON does not.
Invalid{ age: 28 }
Valid
{ "age": 28 }
4. "Unexpected token" errors
This message means the parser found a character it didn't expect at a given position. It usually points to one of the issues above — a stray quote, a missing comma between items, or a value that isn't quoted. The error normally includes a line and column number; go to that spot and look at the character just before it.
Common causes: a missing comma between two items, a value like NaN, undefined, or a date that isn't wrapped in quotes, or a number with a leading zero or a trailing dot.
{
"a": 1
"b": 2
}
The line "a": 1 is missing a comma at the end, so the parser hits "b" unexpectedly.
5. "Unexpected end of input"
This means a bracket or brace was opened but never closed, so the parser reached the end of the text while still expecting more. Check that every { has a matching } and every [ has a matching ]. A collapsible tree view makes unbalanced brackets easy to spot.
6. Comments in JSON
JSON does not support comments — neither // line nor /* block */. If you need comments in a config file, tools often use a superset like JSON5 or JSONC, but standard JSON parsers will reject them. Remove comments before parsing.
7. Extra data after the value
A JSON document holds exactly one top-level value. If you paste two objects back to back, or leave stray characters after the closing brace, you'll get an error about extra or trailing data.
Invalid{ "a": 1 } { "b": 2 }
Wrap multiple values in an array, or send them separately.
Fix it faster
Instead of hunting for these by eye, paste your JSON into the jsonduval validator. It highlights the exact line and column of the first error, colour-codes every value, and lets you collapse nested blocks to check that brackets are balanced. Everything runs in your browser — nothing is uploaded.
Open the JSON validator →