# How do I use just the values of a saved vector?

**URL:** <https://community.gatling.io/t/how-do-i-use-just-the-values-of-a-saved-vector/2457>\
**Category:** Gatling (Open-Source)\
**Created:** [August 10, 2015, 9:47pm UTC](https://community.gatling.io/t/how-do-i-use-just-the-values-of-a-saved-vector/2457 "2015-08-10T21:47:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Figuerno](https://avatars.discourse-cdn.com/v4/letter/f/ce73a5/32.png) [@Figuerno](https://community.gatling.io/u/Figuerno)\
**Post date:** [August 10, 2015, 9:47pm UTC](https://community.gatling.io/t/how-do-i-use-just-the-values-of-a-saved-vector/2457/1 "2015-08-10T21:47:05Z")

</div>

Hi

I have a variable called updatedTickets that has the following -

{“id”:“Vector(53216e5a-9de9-49df-a63c-c0354f3d923b, fc47251b-7948-4865-a20e-4474b93052ba)”}

I would like to use just the values of the vector in the subsequent call

i.e I would like the body to be -

`{ "id": ["53216e5a-9de9-49df-a63c-c0354f3d923b", "fc47251b-7948-4865-a20e-4474b93052ba"] }`

This doesn’t work as it sends everything

.exec(http(“POST to Encrypted Tickets”)

.post("/planner\_tools/v1/event\_api/events/${eventId}/tickets\_encrypted")

.body(StringBody( “”"{“id”:"${updatedTickets}"}""")).asJSON

.check(bodyString.exists)

.check(status.is(200)))

How do I send just the values?

Thank you

p.s - Sorry if this is more scala vs gatling, still trying to get the hang of this.

`

`

.exec(http(“POST to Encrypted Tickets”)

.post("/planner\_tools/v1/event\_api/events/${eventId}/tickets\_encrypted")

.body(StringBody( “”"{“id”:"${updatedTickets}"}""")).asJSON

.check(bodyString.exists)

.check(status.is(200)))

---

<div class="post-metadata">

**Author:** ![notdryft](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/notdryft/32/1103_2.png) [@notdryft](https://community.gatling.io/u/notdryft)\
**Post date:** [August 11, 2015, 10:02am UTC](https://community.gatling.io/t/how-do-i-use-just-the-values-of-a-saved-vector/2457/2 "2015-08-11T10:02:39Z")

</div>

Hi,

“${updatedTickets}” is resolved as “Vector(53216e5a-9de9-49df-a63c-c0354f3d923b, fc47251b-7948-4865-a20e-4474b93052ba)” because gatling is calling the method toString on updatedTickets which prints that way.

If you want to instead print values as [“value1”, “value2”, etc.], you will need to use a combination of map to put the values between quotes, and mkString (with start/separator/end) to pretty print the array itself.

Cheers!

---

<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:** [August 11, 2015, 10:12am UTC](https://community.gatling.io/t/how-do-i-use-just-the-values-of-a-saved-vector/2457/3 "2015-08-11T10:12:27Z")

</div>

Gatling EL has a toJsonString function. Please have a look at the doc.

---

<div class="post-metadata">

**Author:** ![Figuerno](https://avatars.discourse-cdn.com/v4/letter/f/ce73a5/32.png) [@Figuerno](https://community.gatling.io/u/Figuerno)\
**Post date:** [August 11, 2015, 1:43pm UTC](https://community.gatling.io/t/how-do-i-use-just-the-values-of-a-saved-vector/2457/4 "2015-08-11T13:43:43Z")

</div>

I think you mean jsonStringify(), I got closer after this. Only problem, I have now is to remove the quotes as it does it like this now.

{“id”:"[“63518c9c-6a1e-4ec8-bd2b-9aebbc637567”,“435973e3-7d14-42e3-8585-06a01b1f8d35”]"}

Is there an inbuilt way to do that?

---

<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:** [August 11, 2015, 1:46pm UTC](https://community.gatling.io/t/how-do-i-use-just-the-values-of-a-saved-vector/2457/5 "2015-08-11T13:46:20Z")

</div>

You’re the one who wrote those outer quotes, not Gatling.

---

<div class="post-metadata">

**Author:** ![Figuerno](https://avatars.discourse-cdn.com/v4/letter/f/ce73a5/32.png) [@Figuerno](https://community.gatling.io/u/Figuerno)\
**Post date:** [August 11, 2015, 2:00pm UTC](https://community.gatling.io/t/how-do-i-use-just-the-values-of-a-saved-vector/2457/6 "2015-08-11T14:00:11Z")

</div>

Yes, I am an idiot, thank you!

---

<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:** [August 11, 2015, 2:22pm UTC](https://community.gatling.io/t/how-do-i-use-just-the-values-of-a-saved-vector/2457/7 "2015-08-11T14:22:35Z")

</div>

No pro 🙂
