I am encountering issues with the JSONPath library found at https://github.com/JSONPath-Plus/JSONPath in its latest version.
For example:
{
"firstName": "John",
"lastName": "doe",
"age": 26,
"address": {
"streetAddress": "naist street",
"city": "Nara",
"postalCode": "630-0192"
},
"phoneNumbers [1]": [
{
"type": "iPhone",
"number": "0123-4567-8888"
},
{
"type": "home",
"number": "0123-4567-8910"
}
]
}
I am attempting to retrieve "phoneNumbers [1]" using the following path: $..['phoneNumbers [1]']
A Demo Page for testing purposes can be found here:
However, I have encountered an issue due to the square brackets within the string. Can anyone suggest a solution?
I frequently work with JSON objects containing strings with square brackets, so a general solution would be preferred over a specific fix.
Is there a way to escape characters in order to resolve this problem? The JSON object provided above serves as an illustrative example of the issue.
The problem persists even when using only JSONPath, indicating that it is not limited to a particular library or implementation.
Further information on JSONPath can be found at