Fix Trailing Comma Errors in JSON

Getting "Unexpected token }" or "Expected double-quoted property name"? Paste your JSON to locate the trailing comma and fix it in seconds.

Part of the free JSON Formatter & Validator. Runs in your browser — nothing is uploaded.

Fix Trailing Comma Errors in JSON

JSON, unlike JavaScript, does not allow a comma after the last item in an object or array. That single stray comma is one of the most common reasons JSON.parse throws. Paste your document and the validator will point at the position of the problem.

Worked example: A trailing comma and the error it causes

Broken JSON

{
  "name": "kaviforge",
  "version": 2,
}

Validator result

✗ Invalid JSON
Expected double-quoted property name in JSON at position 41 (line 4 column 1)

Practical tip

Delete the comma after the last property, then re-validate. If your editor allows it, turn off "trailing commas" for .json files so the problem stops recurring.

How to use this JSON Formatter

  1. 1Use the live tool above — it runs entirely in your browser and never uploads your data.
  2. 2Paste the sample from the worked example, or use your own input.
  3. 3Copy the result, then adapt the same steps in your editor, script, or pipeline.

Fix Trailing Comma Errors in JSON FAQs

Why does JavaScript allow trailing commas but JSON does not?

JSON is a strict data format with a smaller grammar than JavaScript. Trailing commas in object literals are a JavaScript convenience that the JSON specification never adopted.

Does JSON5 or JSONC allow trailing commas?

Yes. JSON5 and JSON with Comments (used by tsconfig.json and VS Code settings) tolerate them, but standard JSON parsers and most APIs do not.

More JSON Formatter pages

Open the full JSON Formatter tool →