while performing the JSON Assertion using Jmeter , i get the following error.
预期在路径$ [“ body”]中找到具有属性$ ['id']的对象,但 找到“ net.minidev.json.JSONArray”。 根据JSON Provider.'com.jayway.jsonpath.spi.json.JsonSmartJsonProvider',这不是json对象。
please let me know what is the issue ?
答案 0 :(得分:1)
该错误表示您的JsonPath查询与响应数据中的任何内容都不匹配。
例如,如果您有JSON之类的
{
"body": [
{
"id": 28,
"Title": "Sweden"
},
{
"id": 56,
"Title": "USA"
},
{
"id": 89,
"Title": "England"
}
]
}
您将JSON Assertion配置为:
它将失败,因为JSON路径查询匹配> 1个元素:
为了测试28
的值,您需要修改JSON路径查询以指向body
JSON Array
$.body[0].id