JSON looks a lot like a JavaScript object, which is exactly why it breaks so often: things JavaScript allows, JSON does not. When a parser meets one of them it stops with an error such as Unexpected token or Expected double-quoted property name. Here are the mistakes that cause almost every JSON error, what each looks like, and how to fix it.
1. Trailing commas
JSON does not allow a comma after the last item in an object or array.
{"name": "Asha", "age": 31,} ✗
{"name": "Asha", "age": 31} ✓This is the most common error, especially after deleting the last line of a list. Remove the final comma.
2. Single quotes
Strings and property names must use double quotes. Single quotes are not JSON.
{'city': 'Pune'} ✗
{"city": "Pune"} ✓3. Unquoted property names
Every key needs double quotes, even simple ones.
{city: "Pune"} ✗
{"city": "Pune"} ✓4. Comments
Standard JSON has no comments. Files such as tsconfig.json accept them because their tools read “JSON with comments” (JSONC), but an API or JSON.parse will reject them. Remove the comments, or turn on Allow comments in the JSON Formatter to strip them for you.
5. Missing commas or brackets
A missing comma between items, or a missing } or ] at the end, often reports an error on the next line, because that is where the parser realises something is wrong. When the error position looks fine, check the line just before it.
{
"a": 1
"b": 2 ← error is reported here
}6. Quotes and line breaks inside strings
A double quote inside a string must be escaped as \", a backslash as \\, and a line break as \n. Real line breaks inside a string are not allowed.
{"msg": "He said "hi""} ✗
{"msg": "He said \"hi\""} ✓Windows paths are a classic case: "C:\new" contains \n, a line break. Write "C:\\new". The JSON Escape tool turns any text into a safe JSON string.
7. Values JSON does not have
JSON values are only strings, numbers, true, false, null, objects and arrays. These come from JavaScript and are not valid:
undefined: usenullor leave the key out.NaNandInfinity: usenullor a string.- Numbers with leading zeros like
007, hex like0x1For a trailing dot like5.: write7,31and5(or5.0). - Dates are not a type: store them as strings, ideally ISO 8601 such as
"2026-10-07T09:30:00Z".
8. Invisible characters
Text copied from documents, chats or web pages can carry curly quotes (“ ”), non-breaking spaces or a byte-order mark at the start of a file. They look normal but break parsing. If an error points at a character you cannot see a problem with, retype the quotes and spaces around it.
Two problems that are valid but risky
Duplicate keys
{"id": 1, "id": 2} is technically allowed, but most parsers silently keep only the last value, which hides bugs. The JSON Validator warns you about duplicates.
Very large numbers
JavaScript numbers lose precision above 9,007,199,254,740,991, so a long ID such as 12345678901234567890 can change silently after parsing. Send big IDs as strings.
A quick checklist
- Double quotes around every key and string.
- No comma after the last item.
- Commas between all other items.
- Every
{and[closed. - Quotes, backslashes and line breaks escaped inside strings.
- No comments,
undefined,NaNor leading zeros.