Check_Point
156-521 · Question #156
You need to extract multiple fields (name and uid) from each object in the JSON array. Which command is correct?
The correct answer is B. jq '.objects[] | {name, uid}'. Using jq '.objects[] | {name, uid}' extracts a new object with only the desired fields (name, uid) from each item in the array. This is ideal for clean output in scripts.
Check Point API Fundamentals
Question
You need to extract multiple fields (name and uid) from each object in the JSON array. Which command is correct?
Options
- Ajq '.objects[].name, .uid'
- Bjq '.objects[] | {name, uid}'
- Cjq '.objects | name, uid'
- Djq 'name and uid from .objects[]'
How the community answered
(29 responses)- A14% (4)
- B76% (22)
- C7% (2)
- D3% (1)
Explanation
Using jq '.objects[] | {name, uid}' extracts a new object with only the desired fields (name, uid) from each item in the array. This is ideal for clean output in scripts.
Topics
#jq#multiple fields#object construction#JSON query
Community Discussion
No community discussion yet for this question.