Single quotes in JSON
JSON defines exactly one string delimiter: the double quote. Single quotes are not an alternative form, they are not valid anywhere, and that applies to property names as well as to values.
How the message appears
The same fault, worded by different engines. V8 (Chrome, Node, Edge) changed its format around Chrome 109, so older and newer runtimes disagree about the same document.
What causes it
Pasting a JavaScript or Python literal
Both languages treat ' and " as interchangeable, so a dict or object literal copied straight out of source is usually not valid JSON. Python adds two more traps in the same paste: True/False/None instead of true/false/null.
Smart quotes from a document or chat client
Word, Google Docs, Slack and Notion silently replace straight quotes with the typographic pair “ ”. They look almost identical in a proportional font and are not quotes as far as a parser is concerned.
Shell quoting
Wrapping a JSON payload in single quotes for curl is correct; letting those quotes end up *inside* the payload is not. If the JSON itself contains single quotes after the shell is done with it, the quoting nested one level too deep.
The fix
Replace every single quote around a key or string value with a double quote. true, numbers and null are never quoted at all.
{
'name': 'Ada',
'active': true
}{
"name": "Ada",
"active": true
}The example travels in the URL fragment, which browsers never send to a server.
Worth knowing
- A double quote *inside* a string value must be escaped as
\"once you switch. This is why a blind find-and-replace is risky and parsing is not. - Python users:
json.dumps(obj)emits valid JSON;str(dict)andprint(dict)do not.