SmartJson.io
← All JSON error messages

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.

Input: Keys in 'single 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: Single quotes (') are not allowed in JSON
Node 20Expected property name or '}' in JSON at position 1
Node 18Unexpected token ' 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)
Input: A Python dict printed with str()
{'ok': True, 'value': None}
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: Single quotes (') are not allowed in JSON
Node 20Expected property name or '}' in JSON at position 1
Node 18Unexpected token ' 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)
  • 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.

Open the full JSON Repair tool →

Common causes

  1. 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. 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. 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}'.

Related

  • Trailing comma in JSON: "Expected double-quoted property name"
  • "[object Object]" is not valid JSON
  • 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 9, 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