⭐ 0

Invalid JSON Example: Trailing Comma

Check JSON structure and configurations for errors offline in the browser.

🔒 Processed entirely in your browser — nothing you enter here is ever uploaded.

The result appears on this page after you run the tool. Nothing you enter is uploaded.

Processing... 0%
Scanning character structure
Locating brace alignment
Validating data nodes
Mapping syntax errors
Formatting report

Result

About this tool

This page opens the JSON validator preloaded with the same API response structure as the valid preset, except one comma was left after the last property ("inStock": true,) right before the closing brace. The validator runs on load, so the syntax error shown below is a real, live parse failure, not a staged example.

A trailing comma is arguably the single most common JSON syntax error, precisely because it's legal — even encouraged — in JavaScript object literals and in several other data formats, so it's an easy habit to carry over. Strict JSON, unlike JavaScript, does not allow a comma after the last item in an object or array; the JSON.parse engine used by browsers and virtually every JSON library rejects it outright rather than silently ignoring it.

The error message below points to the exact line and column where parsing gave up, which is usually a line or two after the actual trailing comma since the parser only notices something is wrong once it expects another value that never comes. Removing that one comma is the entire fix — compare this preset against valid-api-response-json to see the same structure without it.

Example. The text {"a":1,"a":2} is flagged for a duplicate key even though JSON.parse would keep the last value.

Limit. A trailing comma is a syntax error, and comments are not allowed.