Guides / JSON errors
“Expected property name or '}' in JSON at position 1”
How it appears per engine
- Uncaught SyntaxError: Expected property name or '}' in JSON at position 1 (Chrome / Node.js)
- SyntaxError: JSON.parse: expected property name or '}' at line 1 column 2 of the JSON data (Firefox)
What this error means
Right after an opening brace, JSON allows exactly two things: a double-quoted property name, or a closing brace. This error means the parser found something else — usually an unquoted key or a single-quoted key. That is valid JavaScript object syntax, but JSON is stricter.
Common causes
1. Unquoted property names
JavaScript lets you write {a: 1}; JSON requires every key in double quotes.
Fails
{ a: 1, b: 2 }Works
{ "a": 1, "b": 2 }2. Single quotes instead of double quotes
Single quotes are not JSON — not for keys and not for string values. This bites hardest when hand-writing JSON in shell commands or Python (where single quotes are idiomatic).
Fails
{ 'name': 'Ada' }Works
{ "name": "Ada" }3. A JavaScript object literal pasted as JSON
Copying an object out of source code or a console brings JS-only syntax with it: unquoted keys, trailing commas, comments, undefined. It needs converting, not just quoting.
How to fix it
- Wrap every key in double quotes.
- Replace all single quotes with double quotes (escape inner quotes as \").
- Remove comments, trailing commas, and undefined — none exist in JSON.
- If the data comes from code, produce it with JSON.stringify instead of copying literals.