How to pick the value random in vector then using it in json file ?

I have saved vector in session like this

Vector(permanent/form-question-option/jpg/648267b3-065e-49bf-9cbd-3b174d1e5c2f.jpg, permanent/form-question-option/png/ead07086-f56b-4ad3-8fed-d70912523dd5.png, permanent/form-question-option/jpg/e060a4ce-d799-450a-a27e-cf095f892b80.jpg, permanent/form-question-option/jpg/31ca0c2d-9173-4b8e-a185-f3e3ab82c534.jpg)

And the payload different with the same request.
payload 1 - when added first option:
{
“questionOptions”: [
{
“code”: 1,
“value”: “A”,
“feedback”: null,
“type”: null,
“imageUrl”: “${listUrlImage}”,
}

}
payload 2 - when added the seconds option
{
“questionOptions”: [
{
“code”: 1,
“imageUrl”: “${listUrlImage}”,
},
{
“code”: 2,
“value”: “BB”,
“imageUrl”: “${listUrlImage}”,
}

}

And the script:

val payloadUpload =
Array(
Map(“jsonFile” → “PayloadUpload1.json”),
Map(“jsonFile” → “PayloadUpload2.json”)
).queue

.repeat(2)
{
.feed(payloadUpload)
.exec(http(“Add question type multi choices”)
.post(baseUrl + “/api/forms/update”)
.headers(headers_authorized)
.body(ElFileBody("${jsonFile}")))
}

My question, how to pick the random value in vector to using it in json file? I try with EL “${ listUrlImage .random()}” but it didn’t work.

I try with EL “${ listUrlImage .random()}” but it didn’t work.

It should. What’s your issue exactly? Which version of Gatling do you use?

“${ listUrlImage .random()}”

Extra space ? (or only email format?)

i am using 3.3.1 version. the issue i face in json, it cannot pick a value in vector.

this is email format.

Hi Stéphane LANDELLE, Sébastien BREVET,

I solved this issue with EL ( Using ${ listUrlImage.random()} or ${ listUrlImage.(n)} ) without any update script, the EL method work well, may be some of my mistakes . Thank you for your support.