json - 如何在 jsonpath 中获取条件
问题描述
拥有 json,请提供以下内容:
[
{
"delta": {
"status": {
"old": {
"status": "Stop"
},
"new": {
"status": "Start"
}
}
}
}
]
我怎样才能只获得具有 new.status = 'Start' 的增量?
我尝试使用 Apache 骆驼choice().when().jsonpath(...)
为什么下面的语句不起作用?
$..[?(@.delta.status.new.status=='Start')]
$..delta.status.new[?(@.status=='Start')]
我用过 jsonpath.com
解决方案
您的陈述还可以,我已经使用jsonpath.herokuapp和骆驼jsonpath
组件对其进行了测试,例如第二个返回{status: Start}
推荐阅读
- javascript - 如何从定义 setInterval() 的另一个函数调用 clearInterval()(函数在同一个类中)
- scala - 使用 Map 替换 Spark 中的列值
- javascript -
- javascript - 无法在 Bootstrap 中实现 W3Schools 幻灯片?
- c++ - 模板参数依赖 [[nodiscard]]
- python - 如何使用 slack api 代表另一个用户发送命令
- excel - Excel formula for aggregation and filtering
- reactjs - 使用 material-ui 在 Jest 中进行快照测试的问题
- javascript - Where to initialize variables in Stencil
- php - How to show images which loop infinitely in carousel (images getting from database)