JSON-P 1.1, introduced in Java EE 8, introduces support for JSON Pointer. JSON Pointer is an Internet Engineering Task Force (IETF) standard that defines a string syntax to identify a specific value within a JSON document, similar to what XPath provides for XML documents.
The syntax for JSON Pointer is straightforward, for example, suppose we have the following JSON document:
{ "dateOfBirth": "1997-03-03", "firstName": "David", "lastName": "Heffelfinger", "middleName": "Raymond", "salutation": "Mr" }
If we would like to obtain the value of the lastName
property of the document, the JSON Pointer expression to use would be "/lastName"
.
If our JSON document consisted of an array, then we would have to prefix the property with the index in the array, for example, to obtain the lastName
property of the second element in the following JSON array:
[ { "dateOfBirth": "1997-01-01", "firstName": "David", "lastName": "Delabassee", "salutation...