What the error means
Inside an object, JSON allows only two things after an opening brace or a comma: a double-quoted key, or a closing brace. Expected property name or '}' in JSON means the parser found something else in that spot. The position in the message points at the offending character, which makes this one of the easier JSON errors to locate, but the cause is usually a habit carried over from JavaScript, where object literals are far more forgiving.
The example above contains three such habits in four lines.
Why it happens
- An unquoted key.
name: "Ada"is a valid JavaScript object literal and invalid JSON. Every key must be a string in double quotes. - A single-quoted key or value. JSON has one string delimiter,
". Single quotes are never valid, and neither are backticks. - A trailing comma. After the comma following
"admin", the parser expects another key. It finds}instead — and while that is a legal closing brace, it arrives one token too late. Some engines report this asUnexpected token }rather than this message; both mean the same thing. - A comment.
//or/* */inside JSON produces this error at the first slash. JSON has no comment syntax, however common it is in config files that merely look like JSON. - A Python dictionary pasted directly:
{'key': True}fails on the quote before it ever reachesTrue.
How to fix it
- Paste the text into the formatter above. The error card gives the line and column.
- If the character there is a letter, quote the key. If it is a single quote, change it — and its partner — to a double quote. If it is a closing brace, delete the comma before it. If it is a slash, delete the comment.
- Repeat until the document formats. Each fix usually reveals the next problem a few lines further on.
For input that came from JavaScript source, a Python REPL, or a language model, JSON Repair fixes all of these categories in one pass, which is faster than editing by hand when there are more than a couple.
The corrected example:
{
"name": "Ada",
"role": "admin"
}
If it still fails
- A key that looks quoted may be using typographic quotes (
“name”) after a trip through a word processor or a chat window. They are not". The formatter will point at the first one; replace them all. - If the error appears at line 1, column 1, the text probably starts with something that is not JSON at all — an HTML page, a log prefix, or a code fence. Remove everything before the first
{or[. - Validate the final result with JSON Validator when you need structural diagnostics beyond the first error.
Related errors
Unexpected token } in JSON
Delete the comma after the last property or array item. JSON allows no trailing commas, so the parser reaches } while still expecting another value.
Expected double-quoted property name in JSON
Wrap every key in double quotes and delete any comma that sits directly before a closing brace; JavaScript object syntax is not JSON.