这是我的 JSON:
[
{
"id": 9741962,
"name": "getName",
"isActive": true
},
{
"id": 1,
"name": "New",
"isActive": true
}
]
我想使用 jsonPath 获取所有名称为 :getName 的对象 使用JsonPath怎么办(放心自带的onw)
我试试这个
JsonPath.with(jsonResponse).get("findAll { a -> a.name == getName }");
但我遇到了错误。
java.lang.IllegalArgumentException: No such property: sdfsdf for class: Script1
谢谢。
最佳答案
好的,我找到了,需要添加撇号。
JsonPath.with(jsonResponse).get("findAll { a -> a.name == 'getName' }");
关于java - jsonpath 查找所有对象(放心),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25061500/