How to iterate JSON body for x times and pass variables from Array List


I would like to dynamically create entire child elements of a JSON and pass Array list variable from the previous object…

My JSON looks like,


“parentId” : “ABCD123”

“globalUtilizedAmount”:{ //child element 1
“amount”: +arr.get(0)+ //array variable 0
“globalOriginalAmount”:{ //child element 2
“amount”: +arr.get(1)+ //array variable 1



From the above JSON i would like generate,

  1. multiple globalUtilizedAmount using loop - (here I’ve shown 2 elements as part of childDetails)
  2. replace amount object’s value with an array list variable which ive generated from previous object.

Kindly help!

Try using jsonStringify Gatling EL function.