【发布时间】:2018-07-30 20:00:25
【问题描述】:
对于以下 json 响应 - 我在一个 json 提取器中提取所有 id 作为 flight_id。 现在我要提取上面得到的所有 flight_ids(123, 456) 的状态值。
为此,我在每个控制器下添加了另一个 json 提取器,我使用的 json 路径表达式是 -
$..data[*].[?(@.[".flights"][?(@.["__id"] == '${flight_id}')])].[".status" ]
但这似乎不起作用,我看不到调试采样器中返回的状态。 我不能在 json 路径表达式中传递变量名吗?
还有其他方法吗? 谢谢!
{
"count": 1,
"data": [
{
"__id": "ed6f709c-fc38-4b0e-9064-1170b1a0403d",
"__r": 43,
"__mb": "674a2597-07cb-46a2-a32c-e9bda1171b6d",
"__m": "2018-01-24T21:27:03.689-05:00",
".auths": [],
".createdBy": "7f281748-16de-4f65-901c-61f1a0f2fed4",
".createdDate": "2017-12-04T21:45:37.592-05:00",
".currency": "VND",
".events": [],
".factsheets": [],
".flights":
[
{
"__id": "123",
"__r": 43,
"__mb": "7f281748-16de-4f65-901c-61f1a0f2fed4",
"__m": "2017-12-11T09:18:09.755-05:00",
".latestAuthorization": null,
".latestAuthorizationStatus": null,
".status": "budgeted",
".subflights": [
],
"addedValue.actual": null,
"addedValue.booked": null,
},
{
"__id": "456",
"__r": 43,
"__mb": "7f281748-16de-4f65-901c-61f1a0f2fed4",
"__m": "2017-12-11T09:18:09.755-05:00",
".latestAuthorization": null,
".latestAuthorizationStatus": null,
".status": "actual",
".subflights": [
],
"addedValue.actual": null,
"addedValue.booked": null,
}
]
【问题讨论】:
标签: jmeter