Return matching elements as an array.
Section: Filters and Conditions
Filter array and keep array output
bash
bash
echo '[{"name":"a","active":true},{"name":"b","active":false}]' | jq 'map(select(.active))'Explanation
Wrap `select()` with `map()` when you want an array back.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Filters and Conditions