# Having trouble with POST call with list in body

**URL:** <https://community.gatling.io/t/having-trouble-with-post-call-with-list-in-body/5256>\
**Category:** Gatling (Open-Source)\
**Created:** [September 24, 2019, 3:20pm UTC](https://community.gatling.io/t/having-trouble-with-post-call-with-list-in-body/5256 "2019-09-24T15:20:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francois\_Arsenault](https://avatars.discourse-cdn.com/v4/letter/f/aca169/32.png) [@Francois\_Arsenault](https://community.gatling.io/u/Francois_Arsenault)\
**Post date:** [September 24, 2019, 3:20pm UTC](https://community.gatling.io/t/having-trouble-with-post-call-with-list-in-body/5256/1 "2019-09-24T15:20:48Z")

</div>

Hi,

I’m using Gatling 3.2.1 and having problems calling a method with a list as parameter.

The list is saved as “IdsLettresRecrutement” from a previous call and then used in the body of the next call.

The method is called correctly but the list is parameters is always null.

```auto
val obtenirLettreRecrutementAProduire = http("Obtention des lettres de recrutement à produire")
  .get(urlServeurRequete + contexte + "/RequeteLettreRecrutement/ObtenirAProduire?sort=NAM-asc&page=1&pageSize=1000&group=Lettres-asc&aggregate=Lettres-count&filter=")
  .headers(Headers.headerRequete(url))
  .check(status.in(CodesHttp.serveurRequeteOK))

val scn = 
 .exec(obtenirLettreRecrutementAProduire
  .check(jsonPath("$..Items[*].Id").findAll.saveAs("idsLettresRecrutement")))
  .exec { session =>
 .doIf("${idsLettresRecrutement.exists()}")
 {
  // Production des lettres
  exec(http("Production des lettres de recrutement")
   .post(contexte + "/LettresRecrutement/Produire")
   .headers(Headers.headerPostFormulaire)
   .body(StringBody("""{ "guidsDocumentsSelectionnes":"${idsLettresRecrutement}" }""")).asJson
   .check(status.in(CodesHttp.ok))
   .check(jsonPath("$.DemandeProductionDocumentId").find.optional.saveAs("demandeProductionDocumentId"))
  )

```

---

<div class="post-metadata">

**Author:** ![phiSgr](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/phisgr/32/1437_2.png) [@phiSgr](https://community.gatling.io/u/phiSgr)\
**Post date:** [September 27, 2019, 8:56am UTC](https://community.gatling.io/t/having-trouble-with-post-call-with-list-in-body/5256/2 "2019-09-27T08:56:43Z")

</div>

Hi Francois,

If you turn on debug logging in Gatling, you can see what your EL expands to.

To properly put a list in a JSON, try using jsonStringify in the EL.

“”"{ “guidsDocumentsSelectionnes”: ${idsLettresRecrutement.jsonStringify()} }"""

Notice that there is no quotes surrounding the JSON array.

These two pages of the documentation are helpful:  
[https://gatling.io/docs/current/general/debugging/#logback](https://gatling.io/docs/current/general/debugging/#logback)

[https://gatling.io/docs/current/session/expression\_el/](https://gatling.io/docs/current/session/expression_el/)

Regards,  
George
