JSON error: "Unexpected token" or "expected ',' or '}'"

Last reviewed 2026-09-19

JSON is strict: keys and strings need double quotes, no trailing commas, no comments. Hand-edited files and copy-pasted objects from code almost always break one of those rules, and the parser reports the position where it gave up.

Messages you might see

  • “Unexpected token } in JSON at position 42”
  • “SyntaxError: Expected double-quoted property name in JSON”
  • “JSON.parse: expected ',' or '}' after property value”

Why it happens

  • A trailing comma after the last item in an object or array.
  • Single quotes or unquoted keys (valid in JavaScript, not in JSON).
  • Comments, or a byte-order mark or stray text before the first brace.
  • A truncated file or a value copied with invisible characters.

Try this first (free, no tool needed)

  1. Look at the character at the reported position, and the line before it: the mistake is usually just before the error.
  2. Paste the text into a validator with line numbers, such as your editor's JSON mode or jsonlint.
  3. Remove comments and trailing commas by hand, and check the file starts with { or [.

If that didn't work

These tools run in your browser. Your file is read and repaired on your own device and is never uploaded.

JSON Repair

Repairs the handful of mistakes that make hand-edited or copy-pasted JSON fail to parse (trailing commas, single quotes, unquoted keys) and then pretty-prints the result. It fixes common syntax slips, not data that is missing.

Open JSON Repair

Common questions

Does it guess missing data?

No. It fixes syntax, and only the mistakes it can fix safely.

Is my file uploaded anywhere?

No. The tool runs as a program inside your own browser, so the file is read and repaired on your device and never sent to a server.

Related guides