Reputation: 1008
Hi I have a JSON Object:
{
"idContainer":
[
"213=135864",
"312=35947"
]
}
Now I want to access the string 135864
that is after 213=
(213
is a kind of key inside of the array value, I get the data formatted like this)
213=
135864
and no single or double quotes1.) I am trying to find a filter expression like this idContainer[?('213=*')]
which returns me this element "213=135864"
2.) More convenient would be if I could filter the result even more and just return 135864
but I don't know if this is possible with JSON XPath Syntax
Thanks for help :)
If necessary I could also use Java expressions, but my favorite Solution would be pure JsonPath
Upvotes: 1
Views: 3765
Reputation: 753
If you're using Jayway JSONPath, and if you're working in JAVA you probably are, you can use regular expressions in a filter condition, viz.
$.idContainer[?(@ =~ /213=.*/)]
That produces
[
"213=135864"
]
But there's no way using Jayway to produce
[
135864
]
Upvotes: 1