Single quotes in JSON: "Expected property name or '}'"
By Santhi · Messages captured October 9, 2026 on 11 runtimes · How we test
JSON only accepts double quotes around keys and strings. 'Single quotes' are fine in JavaScript and Python code, so JSON written by hand, or a Python dict printed with str() or print(), fails at the first quote.
What each runtime prints
We ran these inputs through JSON.parse in each browser and Node version, and through json.loads in Python. These are the messages exactly as printed.
{'name': 'Ada'}| Runtime | Exact message |
|---|---|
| Chrome 151Node 24Node 22 | Expected property name or '}' in JSON at position 1 (line 1 column 2) |
| Firefox 153 | JSON.parse: expected property name or '}' at line 1 column 2 of the JSON data |
| Safari 26 (WebKit)Bun | JSON Parse error: Single quotes (') are not allowed in JSON |
| Node 20 | Expected property name or '}' in JSON at position 1 |
| Node 18 | Unexpected token ' in JSON at position 1 |
| Python 3.13Python 3.12Python 3.10 | JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) |
{'ok': True, 'value': None}| Runtime | Exact message |
|---|---|
| Chrome 151Node 24Node 22 | Expected property name or '}' in JSON at position 1 (line 1 column 2) |
| Firefox 153 | JSON.parse: expected property name or '}' at line 1 column 2 of the JSON data |
| Safari 26 (WebKit)Bun | JSON Parse error: Single quotes (') are not allowed in JSON |
| Node 20 | Expected property name or '}' in JSON at position 1 |
| Node 18 | Unexpected token ' in JSON at position 1 |
| Python 3.13Python 3.12Python 3.10 | JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) |
- Safari is the only one that names the problem: "Single quotes (') are not allowed in JSON".
- Every parser that gives a position stops at column 2, the first ', so a Python dict with True and None fails with exactly the same message as plain single quotes. None of them get as far as True.
- Python says "Expecting property name enclosed in double quotes", which is the right hint.
Edit it or paste your own. It runs in your browser; nothing is uploaded.
Common causes
- 1
A Python dict printed instead of serialized
str(data), print(data), f"{data}" and logging a dict all give Python's own format: 'single quotes', True, False and None. It looks like JSON but is not.
- 2
A JavaScript object literal pasted as JSON
Code like {name: 'Ada'} copied into a .json file, a request body or a test fixture.
- 3
Shell quoting
Writing JSON inside a shell command and swapping the quote styles to make the shell happy, as in curl -d "{'a': 1}".
How to fix it
Serialize the data with the JSON library instead of printing it.
JavaScript
const body = JSON.stringify({ name: 'Ada' }); // '{"name":"Ada"}'Python
import json
body = json.dumps({"ok": True, "value": None}) # '{"ok": true, "value": null}'- If you already have text in Python's format and cannot regenerate it, ast.literal_eval() reads it back into a dict safely (it only accepts literals, never code). Then json.dumps() it.
- In a shell, keep the JSON in single quotes outside and double quotes inside: curl -d '{"a": 1}'.