# jsonpath extraction crashed

**URL:** <https://community.gatling.io/t/jsonpath-extraction-crashed/4925>\
**Category:** Gatling (Open-Source)\
**Created:** [April 9, 2019, 11:44am UTC](https://community.gatling.io/t/jsonpath-extraction-crashed/4925 "2019-04-09T11:44:12Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mats\_Hoglund](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@Mats\_Hoglund](https://community.gatling.io/u/Mats_Hoglund)\
**Post date:** [April 9, 2019, 11:44am UTC](https://community.gatling.io/t/jsonpath-extraction-crashed/4925/1 "2019-04-09T11:44:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [April 9, 2019, 1:37pm UTC](https://community.gatling.io/t/jsonpath-extraction-crashed/4925/2 "2019-04-09T13:37:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mats\_Hoglund](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@Mats\_Hoglund](https://community.gatling.io/u/Mats_Hoglund)\
**Post date:** [April 9, 2019, 2:39pm UTC](https://community.gatling.io/t/jsonpath-extraction-crashed/4925/3 "2019-04-09T14:39:04Z")

</div>

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/](http://jsonpath.com/) the json path should work.

Regards,  
Mats

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [April 9, 2019, 2:47pm UTC](https://community.gatling.io/t/jsonpath-extraction-crashed/4925/4 "2019-04-09T14:47:47Z")

</div>

> 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/](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](https://goessner.net/articles/JsonPath/), 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](mailto:slandelle@gatling.io)  
 ![](https://docs.google.com/uc?export=download&id=0B-eSbAvpZEjTVnRCb212SzY1TVE&revid=0B-eSbAvpZEjTVnZyZExySlZDMHZXYnJUa3N3TFBjTWxSdG40PQ)

---

<div class="post-metadata">

**Author:** ![Mats\_Hoglund](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@Mats\_Hoglund](https://community.gatling.io/u/Mats_Hoglund)\
**Post date:** [April 9, 2019, 3:07pm UTC](https://community.gatling.io/t/jsonpath-extraction-crashed/4925/5 "2019-04-09T15:07:20Z")

</div>

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

//Mats

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [April 9, 2019, 3:11pm UTC](https://community.gatling.io/t/jsonpath-extraction-crashed/4925/6 "2019-04-09T15:11:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mats\_Hoglund](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@Mats\_Hoglund](https://community.gatling.io/u/Mats_Hoglund)\
**Post date:** [April 9, 2019, 3:28pm UTC](https://community.gatling.io/t/jsonpath-extraction-crashed/4925/7 "2019-04-09T15:28:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [April 9, 2019, 3:46pm UTC](https://community.gatling.io/t/jsonpath-extraction-crashed/4925/8 "2019-04-09T15:46:35Z")

</div>

[https://gatling.io/docs/current/http/http\_check/#multiple-results](https://gatling.io/docs/current/http/http_check/#multiple-results)

---

<div class="post-metadata">

**Author:** ![Mats\_Hoglund](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@Mats\_Hoglund](https://community.gatling.io/u/Mats_Hoglund)\
**Post date:** [April 9, 2019, 6:58pm UTC](https://community.gatling.io/t/jsonpath-extraction-crashed/4925/9 "2019-04-09T18:58:52Z")

</div>

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