SmartJson.io
← All JSON error messages

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.

Input: A key with no quotes
{name: "Ada"}
RuntimeExact message
Chrome 151Node 24Node 22Expected property name or '}' in JSON at position 1 (line 1 column 2)
Firefox 153JSON.parse: expected property name or '}' at line 1 column 2 of the JSON data
Safari 26 (WebKit)BunJSON Parse error: Expected '}'
Node 20Expected property name or '}' in JSON at position 1
Node 18Unexpected token n in JSON at position 1
Python 3.13Python 3.12Python 3.10JSONDecodeError: 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.

Open the full JSON Repair tool →

Common causes

  1. 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. 2

    A JavaScript object pasted as JSON

    Test fixtures, mock data and config copied out of a .js file keep their bare keys.

  3. 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. 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.

Related

  • Single quotes in JSON: "Expected property name or '}'"
  • JSON Repair
  • JSON Formatter

How we tested: the messages above come from running each input through the real parsers (Chrome 151, Firefox 153, Safari 26 (WebKit), Node 24, Node 22, Node 20, Node 18, Bun, Python 3.13, Python 3.12, Python 3.10) on October 9, 2026. The script and inputs are listed on How we test.

Published October 10, 2026. Found a message that reads differently in your version? Tell us and we will add it.

All Tools & Converters

JSON Tools

  • JSON Hub
  • JSON Formatter
  • JSON Validator
  • JSON Repair
  • JSON Error Messages
  • JSON Viewer
  • JSON Minify
  • JSON Stringify
  • JSON Sorter
  • JSON Compare
  • JSON to CSV
  • JSON to XML
  • JSON to YAML

XML Tools

  • XML Hub
  • XML Formatter
  • XML Validator
  • XML Compare
  • SOAP Formatter
  • WSDL Formatter
  • XML to JSON
  • XML to CSV

CSV Tools

  • CSV Hub
  • CSV Formatter
  • CSV Validator
  • CSV to JSON
  • CSV to XML
  • Compare Tools

    • JSON Compare
    • XML Compare
    • YAML Compare
    • CSV Compare
    • Text Compare

YAML Tools

  • YAML Hub
  • YAML Formatter
  • YAML Validator
  • YAML to JSON
  • Other Tools

    • Converters Hub
SmartJson.io

JSON, XML, CSV and YAML tools that run in your browser. Nothing you paste is uploaded.

Sitemap

Company

  • About Us
  • Contact
  • How We Test
  • Changelog
  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • Disclaimer

© 2026 SmartJson.io. All rights reserved.

Report a problem with this page
Made withfor developers