我尝试将SOAPUI 5.5.0中的jsonpath断言与以下语句匹配:$.root[*][?(@.id==1)].updates
期望= 2
响应测试:
{
"root": [
[
{
"id": 2,
"title": "hello world",
"kind": "post",
"updates": 3,
"comments": [...]
},
{
"id": 3,
"title": "how to best practices",
"kind": "post",
"updates": 0,
"comments": [...]
}
],
[
{
"id": 1,
"title": "Release notes...",
"kind": "newsletter",
"updates": 2,
"forks": [...]
}
]
]
}
soapui似乎找不到ID为1的嵌套实体。
根中有数组的数组。
您可以在JSONpath
以下使用以获得所需的输出
$..[?(@.id==1)].updates[0]