Hello,
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,
.exec(
http(“POST_Method”)
.post(localhost+"/test")
.body(StringBody("""{
“parentId” : “ABCD123”
{
“childDetails”:[
“globalUtilizedAmount”:{ //child element 1
“currency”:“USD”,
“amount”: +arr.get(0)+ //array variable 0
},
“globalOriginalAmount”:{ //child element 2
“currency”:“USD”,
“amount”: +arr.get(1)+ //array variable 1
}
]
}
}""")).asJson
.headers(ApiHeaders)
)
From the above JSON i would like generate,
- multiple globalUtilizedAmount using loop - (here I’ve shown 2 elements as part of childDetails)
- replace amount object’s value with an array list variable which ive generated from previous object.
Kindly help!