我试图获取 JSONPath 表达式来过滤我的 JSON 并使用子数组的值获取整个运动对象。
我有以下 JSON:
[{
"name": "Soccer",
"regions": [{
"name": "Australia",
"leagues": [{
"name": "Australia league",
"inplay": 5,
}
]
}
]
}, {
"name": "Tennis",
"regions": [{
"name": "Germany",
"leagues": [{
"name": "Germany league",
"inplay": 0,
}
]
}
]
}
]
我需要使用 JsonPath 表达式获取“inplay == 0”的整个运动对象。
结果应如下所示:
{
"name": "Tennis",
"regions": [{
"name": "Germany",
"leagues": [{
"name": "Germany league",
"inplay": 0,
}
]
}
]
}
地区和联赛计数可以> 1 因此$[?(@.regions[0].leagues[0].inplay == 0)]
不适合
试过$[?(@.regions[*].leagues[*].inplay == 0)]
,但它不起作用