Demo: extract failed API checks from JSON
jq filters are easiest to review when the input includes both matching and non-matching rows. That makes it clear whether the filter is too broad or too narrow.
- Start with .checks[] to inspect item shape.
- Add select(.status != "ok") only after confirming the field name.
- Build a small output object when the result will become a report.
.checks[] | select(.status != "ok") | {name, status, duration}
---
{
"checks": [
{"name": "db", "status": "ok", "duration": 32},
{"name": "api", "status": "failed", "duration": 914}
]
}