Fix trailing commas, unquoted keys, invalid quotes and other common JSON syntax mistakes with a simple troubleshooting checklist.
Trailing commas and missing commas
One of the most common mistakes is leaving a trailing comma after the last item in an object or array. JavaScript sometimes allows patterns that strict JSON does not, which can confuse people copying data between formats.
The opposite problem also happens: values are listed without the comma needed to separate them.
- Valid JSON never ends the last object field with a comma.
- Every field or array item must be separated correctly.
- When in doubt, run a validator and inspect the line number.
Quotes, keys and data types
JSON requires double quotes around strings and around object keys. Single quotes, unquoted keys and smart quotes copied from rich text editors are frequent sources of errors.
Another issue is mixing up strings and native JSON values. `true`, `false`, `null`, numbers and quoted strings are all distinct.
Advertisement
AdSense slot placeholder
Broken nesting and unmatched brackets
If an opening brace or bracket is not matched correctly, the whole structure becomes invalid. This often happens in long arrays, copied payloads or manually edited configuration files.
Formatting the JSON makes these problems easier to spot because indentation reveals where the structure becomes unbalanced.
Use formatting and validation together
A good workflow is to validate first, then format. Validation catches syntax problems, while formatting makes correct JSON easier to read and maintain.
If you work with APIs, logs or copied JSON snippets every day, having a small formatter nearby saves time and reduces frustration.