Common causes
1. A Python dict printed instead of serialized
print(data) and str(data) produce Python syntax: single quotes, True, None. Use json.dumps to write JSON.
print(order)print(json.dumps(order, indent=2))2. Shell quoting in a curl command
Wrapping the body in double quotes for the shell tempts you to use single quotes inside it. Put the JSON in single quotes for the shell and keep double quotes inside.
curl -X POST https://api.example.com/users -d "{'name': 'Ada'}"curl -X POST https://api.example.com/users -H 'Content-Type: application/json' -d '{"name": "Ada"}'3. An escaped apostrophe
\' is a JavaScript escape, not a JSON one. Inside a double-quoted JSON string the apostrophe needs no escape at all; \' is rejected as an invalid escape.
{"quote": "It\'s done"}{"quote": "It's done"}4. Curly quotes from Word, Slack or a CMS
Rich-text editors replace straight quotes with “ ” and ‘ ’. They look similar but are different characters. Paste JSON through a plain-text editor or turn off smart quotes.
{“name”: “Ada Lovelace”}{"name": "Ada Lovelace"}Frequently asked questions
Why does JSON not allow single quotes?
JSON’s grammar was kept deliberately small so every language could parse it the same way, and it defines strings with double quotes only. JSON5 allows single quotes if you control both ends.
How do I put a double quote inside a JSON string?
Escape it with a backslash: “She said "hi"”. A serializer such as JSON.stringify or json.dumps does this for you.
Can I convert single quotes automatically?
Yes. Fix it in PasteKit swaps single-quoted keys and strings to double quotes and escapes any double quotes inside them. Check the diff, because an apostrophe inside a single-quoted string can be ambiguous.