I have a pet theory that this error exists to punish polyglots. You write JavaScript all day, where 'name' and "name" are interchangeable. You dip into Python, where single-quoted strings are the default style. Then you come back to JSON, which is neither of those languages, and it slaps your wrist. RFC 8259 says strings are delimited by double quotes. There is no leniency mode, no parser flag, no "strict": false option that accepts single quotes. Every conforming parser on earth rejects them.
The tell is the position in the error. "Unexpected token ' at position 1" for input {'name': 'Ada'} means the parser died at the very first single quote, right after the opening brace. If the error points at a lone quote early in your text, you have found your culprit before even scrolling.
Where single-quoted "JSON" actually comes from
In my experience it is one of three sources. First, Python. Calling print(my_dict) or str(my_dict) produces a debugging representation with single quotes, plus Python-isms like None and True that are also invalid JSON. That output is never meant to be parsed as JSON; it is meant for your eyeballs in a terminal. The real fix on the Python side is json.dumps(), which emits proper double-quoted JSON.
print(data) # {'name': 'Ada', 'active': True} - NOT JSON
print(json.dumps(data)) # {"name": "Ada", "active": true} - valid JSON
Second, language models. Ask an LLM for JSON and it will sometimes hand you Python-dict-style output with single quotes, because so much of its training data is Python code. Adding "output strict JSON per RFC 8259, double quotes only" to the prompt reduces this a lot. It does not eliminate it, so validating or auto-repairing model output before you parse it is the part you should never skip.
Third, muscle memory. Hand-writing payloads in a JS or Python editor trains your fingers to reach for the single-quote key. Nothing wrong with it in those languages; just remember you are writing a different grammar the moment the file needs to parse as JSON.
How to fix the JSON single quotes error without breaking apostrophes
The tempting fix is a global find-and-replace of ' with ". Do not do this. It will convert a value like {'note': 'it's broken'} into {"note": "it"s broken"}, which is still invalid JSON, except now the error is somewhere else and you have corrupted the data. The apostrophe inside the string was never the problem; the delimiters around it were.
The correct transformation only replaces quotes that act as delimiters, leaving quotes inside string content alone:
{'note': 'it's broken', 'city': 'Portland'}
{"note": "it's broken", "city": "Portland"}
That is a job for a real tokenizer, not a regex, because regex cannot reliably tell a delimiter quote from a content quote in the general case. Paste the text into the JSON Repair Tool and it handles the conversion string-aware, quoting keys and converting delimiters while leaving apostrophes intact. If you are fixing it in Python and the text is specifically Python-dict syntax, ast.literal_eval followed by json.dumps is the programmatic equivalent.
One more edge worth knowing: mixed quotes. Sometimes you get {'name': "Ada"}, where only half the delimiters are single quotes. The rule is the same; every delimiter must be a straight double quote, keys included. Partially quoting the keys while leaving the values in singles is the kind of thing that happens when someone hand-fixes half the file and gives up.
Paste your single-quoted payload and get valid double-quoted JSON back, apostrophes intact.
Fix My JSON NowFrequently asked questions
Why is {'name': 'Ada'} invalid JSON?
RFC 8259, the JSON specification, allows strings to be delimited only by double quotes. Single quotes are simply not part of the grammar, so every strict parser rejects them. It is valid Python dict syntax and valid JavaScript, which is exactly why it slips in.
How do I fix single quotes in JSON safely?
The safe route is a parser that understands which quotes are delimiters and which are string content, like the free JSON Repair Tool, which converts delimiter quotes without touching apostrophes inside strings. A naive find-and-replace of ' with " breaks any string containing an apostrophe, like "it's".
Why does Python's print(dict) produce invalid JSON?
Python's str() and repr() of a dictionary are debugging representations, not serialization. They use single quotes and Python literals like None, True, and False. Use json.dumps() instead, which produces valid JSON with double quotes, lowercase true/false, and null.
Why do AI models output JSON with single quotes?
Language models are trained on vast amounts of Python code, so they sometimes emit Python-dict-style output with single quotes when asked for JSON. Asking for "strict JSON per RFC 8259" helps, but it is not foolproof, so always validate or auto-repair model output before parsing it.
Get one practical dev-tools guide a week: subscribe to the newsletter for new JSON guides and parser explainers.
Related reading: Why Is My JSON Invalid? The 7 Syntax Errors That Break JSON.parse · The Trailing Comma That Breaks Your JSON (And the 30-Second Fix) · NDJSON Broke My Parser: How to Fix JSON Lines Errors