jmeter JSONPath表达式根据条件从数组中获取对象

huwehgph  于 2023-10-20  发布在  其他
关注(0)|答案(1)|浏览(165)

给定JSON结构

{
  "total_institutions": 2,
  "count_by_institution": [
    {
      "institution": {
        "id": "03629",
        "name": "institutiona03629"
      },
      "total_branches": 5
    },
    {
      "institution": {
        "id": "03659",
        "name": "institutiona03659"
      },
      "total_branches": 3
    }
  ]
}

我是JSon Path的新手。我需要一个JSONPath表达式来获取名称等于institutiona03659的institution对象。因此,给出上面的例子,结果应该是

{
  "institution": {
    "id": "03629",
    "name": "institutiona03629"
  },
  "total_branches": 5
}
xtfmy6hx

xtfmy6hx1#

怎么样

$..[?(@.institution.name == 'institutiona03659')]

更多信息请参阅:

相关问题