# Jsonpath vs Regex extractor

**URL:** <https://community.gatling.io/t/jsonpath-vs-regex-extractor/5729>\
**Category:** Gatling (Open-Source)\
**Created:** [July 21, 2020, 4:11pm UTC](https://community.gatling.io/t/jsonpath-vs-regex-extractor/5729 "2020-07-21T16:11:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Barry\_Perez](https://avatars.discourse-cdn.com/v4/letter/b/7ba0ec/32.png) [@Barry\_Perez](https://community.gatling.io/u/Barry_Perez)\
**Post date:** [July 21, 2020, 4:11pm UTC](https://community.gatling.io/t/jsonpath-vs-regex-extractor/5729/1 "2020-07-21T16:11:42Z")

</div>

Sorry if this has been asked before - I’ve not managed to find an answer by searching.

In Gatling:

If I save some values using regex, I get a session variable of type List[String]  
If I save some values using jsonpath, I get a session variable of type Vector[String]

Why are the two checks producing different types of session variable? I’m sure there’s a rationale behind it.

It makes it trickier if I want to using a single function to do something to the output of either.

To give an idea of the use cases - I might have a webpage where I am getting some data using regex, and then an REST API where I get similar/equivalent data in a different scenario, using jsonpath.

Is there any easy way around this?

Thanks,  
Barry

---

<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:** [July 21, 2020, 4:24pm UTC](https://community.gatling.io/t/jsonpath-vs-regex-extractor/5729/2 "2020-07-21T16:24:07Z")

</div>

List and Vector are implementations of the Seq contract. The actual type is an implementation detail and subject to change.  
You should use Seq on your side.

---

<div class="post-metadata">

**Author:** ![Barry\_Perez](https://avatars.discourse-cdn.com/v4/letter/b/7ba0ec/32.png) [@Barry\_Perez](https://community.gatling.io/u/Barry_Perez)\
**Post date:** [July 22, 2020, 8:36am UTC](https://community.gatling.io/t/jsonpath-vs-regex-extractor/5729/3 "2020-07-22T08:36:09Z")

</div>

Hi Stéphane,

Perfect, thank you - I was hoping that there would be a simple answer, so wanted to ask here in case anybody has the same question in future.

Barry

---

<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:** [July 22, 2020, 8:39am UTC](https://community.gatling.io/t/jsonpath-vs-regex-extractor/5729/4 "2020-07-22T08:39:55Z")

</div>

Cool.  
Translating to Java, it’s a bit like ArrayList vs LinkedList =\> you would use the List abstraction.
