我在 java 中通过放心获得以下响应正文
{
"-1": {
"totalExecutions": 0,
"endDate": "",
"description": "",
"totalExecuted": 0,
"started": "",
"versionName": "Unscheduled",
"expand": "executionSummaries",
"projectKey": "test",
"versionId": -1,
"environment": "",
"totalCycleExecutions": 0,
"build": "",
"ended": "",
"name": "Ad hoc",
"modifiedBy": "",
"projectId": 99,
"startDate": "",
"executionSummaries": {
"executionSummary": [
]
}
},
"7718": {
"totalExecutions": 1,
"endDate": "",
"description": "",
"totalExecuted": 1,
"started": "",
"versionName": "Unscheduled",
"expand": "executionSummaries",
"projectKey": "test",
"versionId": -1,
"environment": "",
"totalCycleExecutions": 1,
"totalDefects": 0,
"build": "",
"createdBy": "xyz",
"ended": "",
"name": "xyz_SignIn",
"totalFolders": 0,
"modifiedBy": "xyz",
"projectId": 99,
"createdByDisplay": "xyz",
"startDate": "",
"executionSummaries": {
"executionSummary": [
]
}
},
"recordsCount": 2
}
提取我使用以下代码的所有名称元素值
String[] test_cycle_values;
JsonPath jsonPathEvaluator = response.jsonPath();
test_cycle_values = jsonPathEvaluator.get("*.[*].name");
我期望的预期结果是 Ad hoc, xyz_signIn
但是我得到了 JsonPathEvauter 的非法参数异常
如何从所有响应正文中检索名称值?JsonPathEvauter jar 版本为 3.0.5
如果我使用 test_cycle_values = jsonPathEvaluator.get("7718.name");
我得到它的价值 xyz_sign In