# Extract data from encoded resposne

**URL:** <https://community.gatling.io/t/extract-data-from-encoded-resposne/5290>\
**Category:** Gatling (Open-Source)\
**Created:** [October 14, 2019, 8:44pm UTC](https://community.gatling.io/t/extract-data-from-encoded-resposne/5290 "2019-10-14T20:44:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jakub\_Obrocki](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@Jakub\_Obrocki](https://community.gatling.io/u/Jakub_Obrocki)\
**Post date:** [October 14, 2019, 8:44pm UTC](https://community.gatling.io/t/extract-data-from-encoded-resposne/5290/1 "2019-10-14T20:44:22Z")

</div>

I try to extract data from response but in Fiddler I see

 ![2019-10-14 22_40_04-Progress Telerik Fiddler Web Debugger.png](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/1X/1dee357c1cf8999a68ac758f6a74a59ca373ac71.png)

And when I copy this content to [https://jsonpath.com/](https://jsonpath.com/) I see

 ![2019-10-14 22_41_19-jsonpath online evaluator.png](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/1X/bf980eb6ca373a632c433d6186d2286e5e9ca165.png)

I guess this is a cause why I get error like \> request\_11: Failed to build request: No attribute named ‘MyConnectionToken’ is defined 1 (50.00%)

Is it possible to handle this kind of reposne in Gatling? Or the only way is to use regex?

---

<div class="post-metadata">

**Author:** ![Jakub\_Obrocki](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@Jakub\_Obrocki](https://community.gatling.io/u/Jakub_Obrocki)\
**Post date:** [October 14, 2019, 9:01pm UTC](https://community.gatling.io/t/extract-data-from-encoded-resposne/5290/2 "2019-10-14T21:01:49Z")

</div>

I test it on [https://regex101.com/](https://regex101.com/)

 ![2019-10-14 22_58_57-Online regex tester and debugger_ PHP, PCRE, Python, Golang and JavaScript.png](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/1X/f3f980fdc4a18c2efe614268a571c33f945b3007.png)

And I added .check(regex(“a-zA-Z0-9=/+{152}”).find.saveAs(“MyConnectionToken”)) but in result I still see \> regex(a-zA-Z0-9=/+{152}).find.exists, found nothing

W dniu poniedziałek, 14 października 2019 22:49:51 UTC+2 użytkownik Jakub Obrocki napisał:

---

<div class="post-metadata">

**Author:** ![Jakub\_Obrocki](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@Jakub\_Obrocki](https://community.gatling.io/u/Jakub_Obrocki)\
**Post date:** [October 16, 2019, 5:24am UTC](https://community.gatling.io/t/extract-data-from-encoded-resposne/5290/3 "2019-10-16T05:24:24Z")

</div>

Ok, yesterday I fixed issue with regex, correct should be [a-zA-Z0-9=/+]{152} but now I get error \> request\_9: Failed to build request: No attribute named ‘MyConnectionToken’ is defined. And now my question is, how can I define it? In other case I got token in header

 ![2019-10-16 07_15_19-Progress Telerik Fiddler Web Debugger.png](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/1X/9e9d178a1088723a7c2ce40d5f1955856754071a.png)

And I guess in script it is defined here:

 ![2019-10-16 07_16_48-C__Gatling_user-files_simulations_logingood.scala - Notepad++.png](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/1X/dea486f0e4d27d788f6b69416fcd85cb82b08343.png)

But token which I extracted is not in header but in body, here is the response header in Fiddler (on bottom)

 ![2019-10-16 07_18_38-Progress Telerik Fiddler Web Debugger.png](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/1X/eb5518cf39fb11ff500370ee344bbe76b7ce1a0a.png)

And the body content

 ![2019-10-16 07_19_47-Desktop.png](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/1X/72a8b9593afe040262611ed4e06a1329cae710bc.png)

How can I define it? Should I create structure similar to headers\_1 map? If yes what should be included? Thanks in advance.

W dniu poniedziałek, 14 października 2019 22:49:51 UTC+2 użytkownik Jakub Obrocki napisał:
