假定json数据如下:
{
"elements": [
{
"name": "Tom",
"age": 12,
"address": "100 XXX Street"
},
{
"name": "Jerry",
"age": 15,
"address": "200 Old St"
},
{
"name": "Marry",
"age": 15,
"address": "300 Carlos Rd"
}
]
}
命令:
jq '.elements[] | select(.name == "Jerry")' data.json
输出结果是:
{
"name": "Jerry",
"age": 15,
"address": "200 Old St"
}
网友评论