I have a json as below. I want a json path expression that checks if [e3] exists in the below json. Can someone help please?
{
"status": "ok",
"error": [
"[e1]",
"[e2]",
"[e3]",
"[e4]"
]
}
The below JSONPath will return a list with one element. Indefinite paths always returns a list. A path is indefinite if it contains an expression - ?(<expression>). Refer What is Returned When?
$.error[?(@ == '[e3]')]
$[?(@.error[?(@ == '[e3]')] != [])]and Jayway JsonPath evaluator.Jsonpathdoesn’t always return json. If the path is definite you can actually cast it to the expected return type.$.statusand$.error[2]returns string