How to Validate JSON Syntax (With Examples)
JSON Validation
When to Validate JSON
Validate JSON before committing config files, pasting API responses into production systems, or debugging webhook payloads that fail to parse.
Real-World Examples
Valid: {"status":"ok","count":3}
Invalid: trailing comma {"a":1,}
Invalid: single-quoted keys from JavaScript pasted as JSON
Common Mistakes
- Pasting JavaScript object literals (unquoted keys, comments, trailing commas)
- Leaving BOM characters or smart quotes from copied documents
- Assuming JSON5 or YAML syntax is valid strict JSON
Developer Tips
- Validate in CI with
jq empty file.json - Pair validation with formatting to spot structural issues faster
Frequently asked questions
Does this tool validate JSON Schema?
No. This checks JSON syntax only. Schema validation requires a separate JSON Schema validator.
Why does valid-looking data fail?
Common causes include trailing commas, single quotes, comments, or invisible Unicode characters in copied text.
Does validation modify my JSON?
No. Validation only reports whether the input parses successfully.