nerdexam
Check_Point

156-521 · Question #153

Which jq command would list the names of all objects in a response containing a JSON array objects?

The correct answer is B. jq '.objects[].name'. To extract names from each element in a JSON array named "objects", use .objects[].name. This expression loops through the array and prints each object's name.

Check Point API Fundamentals

Question

Which jq command would list the names of all objects in a response containing a JSON array objects?

Options

  • Ajq '.objects[] | .uid'
  • Bjq '.objects[].name'
  • Cjq '.objects.name'
  • Djq '.name[].objects'

How the community answered

(42 responses)
  • A
    7% (3)
  • B
    71% (30)
  • C
    5% (2)
  • D
    17% (7)

Explanation

To extract names from each element in a JSON array named "objects", use .objects[].name. This expression loops through the array and prints each object's name.

Topics

#jq#array iteration#JSON arrays#object names

Community Discussion

No community discussion yet for this question.

Full 156-521 Practice