Expected Property Name or '}' in JSON at Position 1: Every Cause and Fix

Published 30 Sep 2026 · 7 min read

This is the error modern V8 (Chrome, Edge, Node 20+) gives you when JSON.parse() opens an object with { and then finds something that isn't a key. Older engines said Unexpected token and a character; the newer wording is more precise, and it changes depending on where in the object the parser got stuck. That is useful: the two messages below point at two different families of mistake. Every example here was run in Node 22 before it went into this page, and each links to a prefilled JSON Lab so you can watch the same error appear on the same input.

Quick answer: the text after { isn't valid JSON. JSON keys must be wrapped in double quotes, and JSON has no comments, no single quotes and no trailing commas. Look at the character at the reported position (position 1 is the first character after the opening brace) and compare it against the table below.

Two messages, two situations

MessageWhat the parser was expectingUsual cause
Expected property name or '}' in JSON at position NRight after {: a key or an immediate }Unquoted key, single-quoted key, comment, stray comma at the start
Expected double-quoted property name in JSON at position NAfter a comma: a key, and nothing elseTrailing comma, double comma, comment after a comma

After a comma a closing brace is illegal, so the parser stops offering it as an option. That one wording difference tells you immediately whether you are looking at a "first key" problem or a "comma" problem.

1. Unquoted keys: a JavaScript object literal pasted as JSON

In JavaScript, { name: "Ava", age: 30 } is a perfectly good object literal. As JSON it is invalid, because keys must be quoted strings. This is the most common way to hit this error: someone copies an object out of source code, a console log, or a Stack Overflow answer and feeds it to a JSON parser.

JSON.parse('{name: "Ava", age: 30}');
// SyntaxError: Expected property name or '}' in JSON at position 1 (line 1 column 2)

Position 1 is the n of name. Fix: quote every key, {"name": "Ava", "age": 30}. If you are in JavaScript and already have a real object, you never needed to parse it: the same mistake as "[object Object]" is not valid JSON.

See it fail live

Unquoted key, error at position 1:

Open this example in JSON Lab

2. Single quotes, and the Python dict trap

JSON strings and keys use double quotes only. Single quotes are legal in JavaScript and Python, so text that looks like JSON but was copied from either language fails at the first quoted key.

JSON.parse("{'name': 'Ava', 'active': true}");
// SyntaxError: Expected property name or '}' in JSON at position 1 (line 1 column 2)

The Python variant deserves its own warning. print(my_dict) or str(my_dict) in Python does not emit JSON. It emits a Python literal: single quotes, plus True, False and None where JSON wants true, false and null. Fix the producer, not the consumer: call json.dumps(my_dict) in Python. Blindly replacing ' with " on the receiving end breaks the moment a value contains an apostrophe.

See it fail live

Single-quoted keys, error at position 1:

Open this example in JSON Lab

3. The trailing comma

A comma after the last property or array element is legal in JavaScript, Python, and most config formats, and illegal in JSON. In an object it produces the second message, because the parser has just consumed a comma and now demands a key:

JSON.parse('{"name": "Ava", "tags": ["a", "b"],}');
// SyntaxError: Expected double-quoted property name in JSON at position 35 (line 1 column 36)

The position points at the closing }, not at the comma, which is why people stare at the wrong character. Look one character to the left. Trailing commas usually sneak in when someone deletes the last entry of a hand-edited file, or when a template loop emits a comma after every item including the last.

The same mistake inside an array reports differently, because arrays have their own wording: [1,2,] gives Unexpected token ']'. If you see that form, it is the same bug in a different container.

See it fail live

Trailing comma, error points at the closing brace (position 35):

Open this example in JSON Lab

4. A trailing comma buried in a nested object

The reported position is what makes this one tractable on a large payload. In a five-thousand-line response you cannot eyeball the bug, but position 18 tells you exactly where to look.

JSON.parse('{"users":[{"id":1,},{"id":2}]}');
// SyntaxError: Expected double-quoted property name in JSON at position 18 (line 1 column 19)

Paste the payload into JSON Lab and the error is reported against your own text, so you can jump to the offending line instead of counting characters. The fix is to remove the comma after "id":1.

See it fail live

Trailing comma inside an array of objects (position 18):

Open this example in JSON Lab

5. Comments in a "JSON" config file

Strict JSON has no comment syntax at all. But tsconfig.json, VS Code's settings.json and several other tools accept comments through a lenient parser, so developers reasonably assume the format allows them. Copy that file into anything that calls JSON.parse() and it fails, often on the first comment:

JSON.parse('{\n  // config\n  "port": 8080\n}');
// SyntaxError: Expected property name or '}' in JSON at position 4 (line 2 column 3)

Note the line and column: line 2 column 3 is the first / of the comment. Either strip the comments before parsing, or parse the file with a JSONC/JSON5-aware library. Do not "fix" it by deleting the comments from a file another tool expects to be commented.

See it fail live

A comment where a key was expected (line 2, column 3):

Open this example in JSON Lab

6. Doubled or leading commas

Merge conflicts, string concatenation and templated output all produce ,, now and then. After the first comma the parser wants a key, finds a second comma, and reports the same message as a trailing comma:

JSON.parse('{"name": "Ava",, "age": 30}');
// SyntaxError: Expected double-quoted property name in JSON at position 15 (line 1 column 16)

If you generate JSON by concatenating strings, stop: build a data structure and call JSON.stringify() on it, and separators become the serializer's problem instead of yours.

See it fail live

Double comma, error at the second comma (position 15):

Open this example in JSON Lab

Debugging checklist

  1. Read which of the two messages you got. "Expected property name or '}'" means the problem is at the first key; "Expected double-quoted property name" means it is right after a comma.
  2. Go to the reported position. For the comma variant, look at the character just before it; the parser is complaining about what came after the comma.
  3. Check the quotes on every key: double quotes only, no bare words.
  4. Scan for anything a config format allows but JSON doesn't: comments, trailing commas, True/None, undefined, NaN.
  5. Fix the code that produced the text (JSON.stringify(), json.dumps()) rather than regex-patching the output.

Related errors with different causes: Unexpected token in JSON covers the wrong-first-character cases (HTML error pages, BOMs, undefined), and Unexpected end of JSON input covers truncated payloads.

📋 Paste it and see exactly where it breaks

JSON Lab formats and validates entirely in your browser, so nothing you paste is uploaded. The optional AI Repair button is the exception: it sends your input to Google's Gemini API.

Open JSON Lab →

← Back to Blog · See also: Unexpected Token in JSON →