Reputation: 8415
I think this is almost right I'm just missing a piece, if I select Atlas
I want to display the Id
echo "${json}" |jq '.[] | select(.name=="atlas" | .id)'
JSON
[
{
"name": "atlas",
"id": 2314430,
"slug": "atlas",
"description": "",
"privacy": "closed",
"url": "https://api.github.com/teams/2314430",
"members_url": "https://api.github.com/teams/2314430/members{/member}",
"repositories_url": "https://api.github.com/teams/2314430/repos",
"permission": "pull"
},
{
"name": "HAL",
"id": 2318635,
"slug": "hal",
"description": "",
"privacy": "closed",
"url": "https://api.github.com/teams/2318635",
"members_url": "https://api.github.com/teams/2318635/members{/member}",
"repositories_url": "https://api.github.com/teams/2318635/repos",
"permission": "pull"
}
]
Upvotes: 0
Views: 449
Reputation: 8415
I had the bar on the wrong side
jq '.[] | select(.name=="atlas") | .id'
Upvotes: 1