Step-by-step debugging flow
When a JSON payload fails to parse, work through these steps in order. JSON errors cascade β fixing the first one often clears several others automatically.
- Paste your raw JSON into the formatter exactly as received β don't clean it first.
- Read the first syntax error only. The line and column number is exact.
- Fix that one error, then re-run validation before changing anything else.
- Repeat until the formatter reports no errors.
Most frequent JSON errors
These four account for the vast majority of JSON parse failures in the real world:
- Trailing commas β
,]or,}at the end of an array or object. JSON does not allow them; JavaScript objects do. - Single quotes β JSON requires double quotes (
"key": "value"). Single-quoted strings are invalid. - Unquoted property names β
{ key: "value" }is valid JavaScript but invalid JSON. - Comments β
// commentand/* block */are not part of the JSON spec.
Beautify vs Minify β when to use each
Quick reference
- Beautify (pretty-print) β use during development and debugging. Indents nested structures for easy reading. Never put beautified JSON in production API responses unnecessarily β it wastes bandwidth.
- Minify β removes all whitespace. Use for production payloads, inline JSON-LD in HTML, and stored config files where size matters.
JSON-LD for SEO: extra considerations
Formatting JSON-LD structured data is not just about syntax β it also needs to match the Schema.org vocabulary. The formatter catches syntax errors but won't flag incorrect property names.
- After fixing syntax, test with Google's Rich Results Test.
- Ensure required properties for your schema type (
@type,name, etc.) are present. - Minify before embedding in a
<script type="application/ld+json">tag.
JSON vs YAML vs TOML for configuration
If you control the format, pick based on your needs: JSON is predictable but verbose. YAML allows comments and multi-line strings but indentation errors are silent. TOML is designed for config and handles nested structures more readably than JSON. Use JSON where tooling interoperability matters most.
Before-you-publish checklist
- No trailing commas after the final key or array item.
- All property names and string values use double quotes.
- Objects and arrays open and close in the correct order.
- Minified version still validates after copy-paste.
- If JSON-LD: required Schema.org properties are present.