nerdexam
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)
  • A
    72% (26)
  • B
    17% (6)
  • C
    3% (1)
  • D
    8% (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.

Full 156-521 Practice