我有以下json,并且当类型名称为“ route”时,我需要获取cntry = India
$.api.address_components.*.types[?(@.name=='route')]["cntry","name"]
{
"api": {
"address_components": [
{
"cntry": "India",
"short_name": "Yonge St",
"types": [
{
"name": "route"
}
]
},
{
"long_name": "USA",
"short_name": "Willowdale",
"types": [
{
"name": "Willowdale",
"name3": "political"
}
]
}
],
"status": "OK"
}
}
尝试使用时无法提取
$.api.address_components.*.types[?(@.name=='route')]["cntry","name"]
获取名称而不是国家/地区。
预先感谢