You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i'm trying to reach item.thing and filter the array like this :
{item.thing[?(@.key=="match")].value}.get(0)=='b'"
it's doesn't works because "item" key is missing from my json (seems fair)
so i tried to escape the key :
{"item.thing"[?(@.key=="match")].value}.get(0)=='b'"
but doesn't seems to work neither apparently due to the filter function
not sure how to find correct syntax neither if it's even possible with filter function
it's working when i don't have a key with a dot, e.g :
{item[?(@.key=="match")].value}.get(0)=='b'"
any suggestion ?
The text was updated successfully, but these errors were encountered:
The problem arises because dots are typically used as delimiters in JSONPath expressions, so having a key with a dot in it can lead to unexpected behavior.
In this case, since your key is "item.thing," it is being interpreted as a nested structure. You've tried escaping the dot with quotes, but it seems that the filter function is causing complications.
One way to approach this is to use the bracket notation to access the property. Here's an example that might work for your case:
json
['item.thing'][?(@.key=="match")].value
This way, you are treating "item.thing" as a single key rather than a nested structure. The bracket notation can help in cases where the key contains special characters like dots.
This assumes that the JSONPath library you are using supports the bracket notation for keys.
If this doesn't work, you might need to refer to the documentation or specific implementation details of the JSONPath library you are using to see if there are any special considerations or syntax for handling keys with dots. If the library supports escaping characters in keys, check for the correct syntax according to its documentation.
Hello, i'm using JsonPath + SPEL
Considering this json :
i'm trying to reach item.thing and filter the array like this :
{item.thing[?(@.key=="match")].value}.get(0)=='b'"
it's doesn't works because "item" key is missing from my json (seems fair)
so i tried to escape the key :
{"item.thing"[?(@.key=="match")].value}.get(0)=='b'"
but doesn't seems to work neither apparently due to the filter function
not sure how to find correct syntax neither if it's even possible with filter function
it's working when i don't have a key with a dot, e.g :
{item[?(@.key=="match")].value}.get(0)=='b'"
any suggestion ?
The text was updated successfully, but these errors were encountered: