I have an expression in JsonPath which outputs me something like the following:
[
"someString"
]
however, this causes my Java code to crash, because I cannot assign it directly to a string. Yes, I could get the first position of the Array in Java, but it would be nicer to directly become this from JsonPath:
{
"someString"
}
I have tried something like {jsonPathExpression}[0]
, but then I get an empty array... Am I missing something?
Here a Json Sample Code:
{
"products":[
[
"foo",
"bar",
"notthisone",
"456",
"789",
"000"
],
[
"foo",
"bar",
"bingo",
"456",
"!!!!",
"000"
]
]
}
and the path: $.products[?(@[2] == 'bingo')][4]
And please don´t blame the ugly json structure ([] braces after products instead of {}), as you can imagine, it is a remote service which I need to call and want only the necessary data... ;)