Using com.fasterxml.jackson.databind.JsonNode and the .at(JSONPointerExperssion) method I am getting JSON nodes and values out of JSON.
I can get my objects & nodes. I can read values just fine. But I'm trying to read a specific value from the last element in a JSON Array using a JSON Pointer Expression. Can this be done?
Example:
{
"Items": [
{
"itemId": 123
},
{
"itemId": 456
}
]
}
Reading https://datatracker.ietf.org/doc/html/rfc6901 I see I can get specific array elements by their index, ie:
/Items/0/itemId evaluates to 123
/Items/1/itemId evaluates to 456
Does anyone know how to write a JSON Pointer Expression that will refer to the last element?
I've tried a few things including:
/Items/-1/itemId
(Yes I know specs say using - will give you an error, but ya gotta try )