杰克逊树映射器是否允许匹配类似于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的内容?