how to dynamically fill JSON array with object

Hello,

In my use case, I have run a post request with a list of json (json array with object) and knowing that this list will be filled in a dynamic and random way for some data for example for the attribute idFront etc and for the attribute IdRestaurant and IdEmployee id will be retrieved from a csv file. All of this is functional for the moment.

Through this figure I want to go to the list for example 30 poiting model for employees for example you have 30 dynamically generated object.
The problem is: that I do not know how instead of repeating the object 30 times, I put a single object and it will take different values for the same request.

As you can see in the picture I tried with the IdFront attribute but it extracts just one value for the first attribute and for the second there is no value.

I need help please

Hello
As per the doc https://gatling.io/docs/current/session/feeder , have you tried this?

feed(feeder, 2)

This will provide two values from the csv based on the fetch method(circular, random …)
we need to substitute like ${idFront1} and ${idFront2}.
you can give the number as per your need

is this what you expect?

Thanks

Thanks for your help

it works now when I used feed (feeder, 2), I got two differenet values.
But in my case I have 30 object in the json array to fill in, so it is not omptimized to repeat 30 times and put idFront1 until IdFront30. Is there a more optimized and simplified way?

I think we need to write a custom code to loop the feeder and append the list of json object to a String.
This is just an idea

loop(30){
→ feeder
→ append the json object to string
}
exec(json string)

by this way we can optimize it.

If you write one, paste the solution here, it will be useful for someone later