jq empty input.json`jq empty` is concise and script-friendly for validation-only workflows.
How to validate JSON, spot parse failures, repair common mistakes, and debug malformed payloads quickly.
Fast ways to check whether a document is valid JSON.
jq empty input.json`jq empty` is concise and script-friendly for validation-only workflows.
python -m json.tool input.jsonA built-in option that many systems already have.
node -e 'JSON.parse(require("fs").readFileSync("input.json", "utf8")); console.log("valid")'Useful in JavaScript-heavy environments.
The mistakes most likely to break a JSON payload.
{ "name": "Ada" }`{ 'name': 'Ada' }` is invalid JSON.
[
1,
2,
3
]`[1,2,3,]` is invalid JSON.
{ "enabled": true }`{ enabled: true }` is valid in some JavaScript objects but not in JSON.
Use `\n` rather than an actual line break inside a string literal.
{
"text": "line 1
line 2"
}A raw line break inside the quotes breaks parsing.
jq . broken-or-ugly.json > normalized.jsonThis is useful once the file parses and you want a canonical pretty form.