Hi,
I’ve a problem with jsonPath and a specific json response.
Here’s my JSON-Response: {“data”:[[22091],[22094],[22090],[22092],[22093]],“timestamp”:1396877533190}
It fails if I try to save it via → .check(jsonPath("$.data[*][0]").saveAs(“all_contacts”)))
15:48:33.943 [INFO ] i.g.h.a.AsyncHandlerActor - Request ‘GetAllContacts’ failed: jsonPath($.data[].[]).exists failed, could not extract: could not extract : string matching regex [$_\p{L}][$_\-\d\p{L}]*' expected but
[’ found
Any idea what’s going wrong?!
Greetings
Niko
latest 2.0.0-SNAPSHOT build.
Hi Nikolaos,
I just tried your example, it works perfectly. This unit test passes.
it should “Mailing-list test case” in {
val json = parseJson(""" {“data”:[[22091],[22094],[22090],[22092],[22093]],“timestamp”:1396877533190} “”")
JsonPath.query("$.data[*][0]", json) should findOrderedElements(int(22091), int(22094), int(22090), int(22092), int(22093))
}
Now, notice that your example is NOT the same as what there is in the log exception.
Here is the correct version for it :
jsonPath($.data[].[]) → jsonPath($.data[][])
regards
Nicolas
Hi Nicolas,
yep works fine. Thx for the hint
Greetings
Niko