Print/find 嵌套数组中的元素
Print/find element from nested array
有人可以协助使用 REST Assured 断言嵌套数组中的至少一个元素吗?
下面是我要提取的元素数组的一部分(即 5,41 或 2,78):
"visible": {
"zone": [
[
[
5.41,
3.58
],
[
6.23,
2.78
],
],
"type": "array"
},
唯一确认成功的是'not Null':
Response response = given().param(parameterOne).param(parameterTwo).
get("http://URI/api/zone");
response.jsonPath().prettyPrint();
response
.then()
.assertThat()
.statusCode(HttpStatus.OK.value())
.body("$.size()", greaterThan(0))
.body("[0].visible.zone", notNullValue());
};
提前致谢
通过以下行解决了它:
.body("[0].visible.zone[0][0][0]", is(5.41));
有人可以协助使用 REST Assured 断言嵌套数组中的至少一个元素吗? 下面是我要提取的元素数组的一部分(即 5,41 或 2,78):
"visible": {
"zone": [
[
[
5.41,
3.58
],
[
6.23,
2.78
],
],
"type": "array"
},
唯一确认成功的是'not Null':
Response response = given().param(parameterOne).param(parameterTwo).
get("http://URI/api/zone");
response.jsonPath().prettyPrint();
response
.then()
.assertThat()
.statusCode(HttpStatus.OK.value())
.body("$.size()", greaterThan(0))
.body("[0].visible.zone", notNullValue());
};
提前致谢
通过以下行解决了它:
.body("[0].visible.zone[0][0][0]", is(5.41));