SOAPUI与多暗数组中的jsonpath不匹配

问题描述 投票:0回答:1

我尝试将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的嵌套实体。

automated-tests soapui jsonpath
1个回答
0
投票

根中有数组的数组。

您可以在JSONpath以下使用以获得所需的输出

$..[?(@.id==1)].updates[0]

© www.soinside.com 2019 - 2024. All rights reserved.