Check_Point
156-521 · Question #158
Which jq expression would you use to get all objects with the type "host" from a JSON response?
The correct answer is A. jq '.[] | select(.type=="host")'. jq '.[] | select(.type=="host")' filters through a list of JSON items and selects those where type equals "host". This is useful when working with mixed object types.
Check Point API Fundamentals
Question
Which jq expression would you use to get all objects with the type "host" from a JSON response?
Options
- Ajq '.[] | select(.type=="host")'
- Bjq 'type == host'
- Cjq '.objects | .type="host"'
- Djq 'host.type==true'
How the community answered
(36 responses)- A72% (26)
- B17% (6)
- C3% (1)
- D8% (3)
Explanation
jq '.[] | select(.type=="host")' filters through a list of JSON items and selects those where type equals "host". This is useful when working with mixed object types.
Topics
#jq#select filter#object type#JSON filtering
Community Discussion
No community discussion yet for this question.