json - JQ select name 显示id
问题描述
我认为这几乎是正确的我只是缺少一块,如果我选择Atlas
我想显示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"
}
]
解决方案
我把酒吧弄错了
jq '.[] | select(.name=="atlas") | .id'
推荐阅读
- database - xampp 不工作时如何恢复数据库
- c++ - 是否可以使用指针作为模板参数?
- javascript - 画布 fillText 和 fillRec 不呈现
- powershell - 是命令 Get-PnPFolderItem 的属性或字段“ServerRelativeUrl”的一部分
- javascript - 如何从子组件中获取父表单的字段?
- .htaccess - htaccess 重写多个参数
- android - 当达到设定的时间时,我的 AlarmManager 可以发出第一个警报,而不是在第一次重复之后?
- c# - 无法从 Jenkins 获得最后的构建状态 - 403 被禁止
- r - 从 R 中当前数据集中不存在的列表中创建新变量
- sql - 如何获得按城市和年份分组的最后支付金额?