JSON formatter guide: fix invalid JSON fast
Written by Gabriel C.
Use this checklist whenever an API payload or config file fails to parse.
Step-by-step debugging flow
- Paste your raw JSON into a formatter.
- Run validation and read the first syntax error.
- Fix one error at a time, then re-run format.
Most frequent JSON errors
- Trailing commas
- Single quotes around strings
- Unquoted property names
- Comments in strict JSON
When to beautify vs minify
Beautify for debugging and readability. Minify for payload size and production transfer.
A practical debugging sequence
Start by formatting the raw payload exactly as received. If the parser throws an error, fix the first reported line before touching anything else. JSON problems often cascade, so one missing quote or comma can trigger multiple downstream errors that disappear after the first fix.
JSON-LD and API payloads need different caution
For API work, the goal is valid transport data. For JSON-LD, the goal is valid transport data plus correct schema structure. A formatter helps with syntax, but you still need to confirm property names, nesting, and schema types match the vocabulary you are trying to publish.
Quick before-you-publish checklist
- No trailing commas remain after the final key or array item.
- All property names and string values use double quotes.
- Objects and arrays open and close in the right order.
- The minified production version still validates after copy-paste.
- If the snippet is JSON-LD, required Schema.org properties are present.