Unquoted keys in JSON: {name: "Ada"} is JavaScript, not JSON
By Santhi · Messages captured October 9, 2026 on 11 runtimes · How we test
In JSON every property name is a string in double quotes. JavaScript object literals, JSON5 and the MongoDB shell all allow bare names, so {name: "Ada"} is valid in those and fails in every JSON parser at the first letter of the key.
What each runtime prints
We ran this input 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: Expected '}' |
| Node 20 | Expected property name or '}' in JSON at position 1 |
| Node 18 | Unexpected token n 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) |
- Chrome, Node 20+ and Firefox say "Expected property name or '}'" at column 2. That is the same message, at the same column, as for 'single quotes', so the message alone cannot tell the two apart. Look at the character at column 2.
- Python says "Expecting property name enclosed in double quotes", which names the fix.
- Safari and Bun say only "Expected '}'", with no position. They say exactly the same for a missing comma.
- Node 18 says "Unexpected token n in JSON at position 1". The n is the first letter of the key.
Edit it or paste your own. It runs in your browser; nothing is uploaded.
Common causes
- 1
console.log output copied as JSON
Node's console.log prints objects in its own format: { name: 'Ada' }, with bare keys and single quotes. Copying that from a terminal into a .json file or a request body fails.
- 2
A JavaScript object pasted as JSON
Test fixtures, mock data and config copied out of a .js file keep their bare keys.
- 3
JSON5 or HJSON read by a JSON parser
Some config files are written in JSON5, which allows bare keys, comments and trailing commas. A tool that reads them with JSON.parse fails at the first key.
- 4
MongoDB shell output
mongosh prints documents like { _id: ObjectId(...), name: "Ada" }. The bare keys fail first; ObjectId(...) would fail next.
How to fix it
In code, let the serializer quote the keys. For text you cannot regenerate, read it with a JSON5 parser and write it back out as JSON.
JavaScript
// Logging: print JSON, not Node's inspect format
console.log(JSON.stringify(obj, null, 2));
// Text with bare keys (JSON5): npm i json5
import JSON5 from 'json5';
const data = JSON5.parse('{name: "Ada"}');
const text = JSON.stringify(data); // '{"name":"Ada"}'Python
import json
import json5 # pip install json5
data = json5.loads('{name: "Ada"}')
text = json.dumps(data) # '{"name": "Ada"}'- JSON Repair quotes bare keys and lists each change. It keeps the values as they are.