jsonpath extraction crashed

Hi,
I am trying to save parameter from jsonpath:

`
.check(jsonPath("$.[0].paymentId").saveAs(“paymentIdPoints”))

`

from the following json response:

{ "ea5fb642-099d-4b7a-8c25-dc91eee7e0fb": [ { "name": "points", "amount": 32, "currency": "SEK", "paymentProvider": 3, "purchaseId": 123456, "paymentId": 564231 }, { "name": "credit", "amount": 63, "currency": "SEK", "paymentProvider": 1, "purchaseId": 234567, "paymentId": 765432 } ] }

When I do this I get the following error:

`
jsonPath($…[0].paymentId).find.exists extraction crashed: string matching regex ‘[^*.[]()=!<>\s]+’ expected but ‘[’ found

`

What could possibly went wrong?

I am running Gatling v3.0.3 through Maven.

Thanks,
Mats

Syntax is invalid.

Root ($) is an object so there’s no way .[0] could mean something.

Please explain what you’re trying to achieve with words.

Hi Stéphane,
Thanks for your quick reply! I am trying to extract the value from the first apperance of paymentId.
According to http://jsonpath.com/ the json path should work.

Regards,
Mats

Thanks for your quick reply! I am trying to extract the value from the first apperance of paymentId.

$…paymentId is then the most straightforward way.

According to http://jsonpath.com/ the json path should work.

People can buy domain names and get their hands on Github organizations, that doesn’t turn them into a reference.
Sadly, the original author, Mr Goessner, didn’t provided a full spec or a TCK.
Generally speaking, Javascript and PHP implementations are not renown for semantics correctness…

Regards,

Stéphane Landelle

GatlingCorp CTO
slandelle@gatling.io

Well, but then I will get
[
564231,
765432
]
I do only want the first value.

//Mats

No because find will only pick the first value, on contrary to findAll.

Ok, thanks! But how do I do if i want the second value?

https://gatling.io/docs/current/http/http_check/#multiple-results

Thanks a lot for your quick support, that did the trick! :slight_smile: