JsonPath exception "string matching regex `[$_\p{L}][$_\-\d\p{L}]*'"

680 views
Skip to first unread message

nikolaos....@googlemail.com

unread,
Apr 7, 2014, 10:02:49 AM4/7/14
to gat...@googlegroups.com
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

Stéphane Landelle

unread,
Apr 7, 2014, 10:03:48 AM4/7/14
to gat...@googlegroups.com
Gatling version, please?


--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

nikolaos....@googlemail.com

unread,
Apr 7, 2014, 10:09:25 AM4/7/14
to gat...@googlegroups.com
latest 2.0.0-SNAPSHOT build.

Nicolas Rémond

unread,
Apr 7, 2014, 10:30:10 AM4/7/14
to gat...@googlegroups.com
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



--

nikolaos....@googlemail.com

unread,
Apr 7, 2014, 4:00:14 PM4/7/14
to gat...@googlegroups.com
Hi Nicolas,

yep works fine. Thx for the hint

Greetings
Niko
Reply all
Reply to author
Forward
0 new messages