JSON Formatter & Validator

Unquoted keys in JSON: "Expected property name or '}'"

JSON keys must be wrapped in double quotes. Exact error messages and the fix for {name: "Kim"}-style objects.

Error messages you may see

Chrome · Edge · Node.jsSyntaxError: Expected property name or '}' in JSON at position 1 (line 1 column 2)
Older Chrome · Node.js 18 and earlierSyntaxError: Unexpected token n in JSON at position 1
Python json.loadsjson.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
This toolLine 1, Col 2: Keys must be wrapped in double quotes

Why it happens

In JavaScript you can write {name: "Kim"}, but in JSON every key is a string and must be in double quotes. This is the most common error when a JavaScript object is pasted as JSON.

Invalid

{name: "Kim", age: 30}

How to fix

Wrap every key in double quotes: {"name": "Kim"}. To get valid JSON from a JavaScript object, use JSON.stringify(obj).

Fixed

{"name": "Kim", "age": 30}

Open this example in the JSON formatter →

Tip: the formatter fixes this in one click with the 🔧 Auto-fix button.

Other common JSON errors