Expected property name or '}' in JSON at position N (line L column C)
The parser opened an object and expected either a double-quoted key or a closing brace. It got something else. In real data the something else is nearly always a single quote or a bare identifier, which means the text is a Python dict repr or a JavaScript object literal rather than JSON.
Paste your JSON and see exactly where it breaks
Nothing you paste leaves your browser. The connect-src allowlist makes that a browser guarantee rather than a promise. Check it yourself
What actually causes it
Ranked by how often each one turns out to be the answer.
-
01 Single-quoted keys, from a Python dict printed with str()
print(my_dict) and str(my_dict) produce Python syntax, not JSON: single quotes, and True, False and None instead of true, false and null. Use json.dumps to produce JSON.
Breaks
{'name': 'Priya', 'active': True}Works
{"name": "Priya", "active": true} -
02 Unquoted keys, from a JavaScript object literal
JavaScript allows bare identifiers as keys. JSON does not, even when the key would be a perfectly valid identifier.
Breaks
{ name: "Priya", role: "admin" }Works
{ "name": "Priya", "role": "admin" } -
03 A comment inside a config file
JSON has no comment syntax. A // or /* inside an object lands here.
-
04 Typographic quotes from a word processor
Autocorrect in Word, Google Docs, Notes and several chat clients converts straight quotes to curly ones. Curly quotes are ordinary characters to a JSON parser, not string delimiters. Our validator names them specifically rather than reporting a generic unexpected token.
The same mistake in other runtimes
The underlying problem is identical; only the wording differs. If a colleague reports one of these, they are looking at the same thing you are.
| Python | Expecting property name enclosed in double quotes: line 1 column 2 (char 1) |
|---|---|
| Java (Jackson) | Unexpected character ('s' (code 115)): was expecting double-quote to start field name |
Questions
- How do I produce JSON from a Python dict properly?
- json.dumps(obj) returns a JSON string. str(obj) and print(obj) return Python syntax that only looks similar. This is one of the most common sources of invalid JSON in the wild.
- Can I convert a Python dict repr to JSON?
- Yes. ast.literal_eval parses it safely into a Python object which you can then json.dumps. Our repair tool does the same job in the browser, converting the single quotes and the True, False and None literals in one pass.
Fix it now
Paste the payload into the tool above, or go straight to the one built for this job.
Convert it to valid JSON