杰克逊树映射器是否允许匹配类似于 xpath 的键值?我有一个返回的通用列表并想要匹配 key="key" 然后获得与键相同级别的值?
json:
[
{
"key":"value1",
"values":[
10.5
]
},
{
"key":"value2",
"values":[
20.5
]
}
o o o more values here... o o o
]
代码:
JsonNode rootNode = mapper.readTree(thejsonfromabove);
//How can I do something like this?
// ... match the key = value1 and the the values within? psdeudo code below...
int whatever = rootNode.path(?).path("key"=="value1").path(0).getIntValue(); // Get 10.5
匹配节点时是否有类似于xpath的东西?