{
“productType”: “1000”,
“allowedToOpen”: true,
“payment”: [{
“ean”: “axxxxxxx.”,
“name”: “Hr N P van Splunter”,
“balance”: 0.00,
“currency”: “EUR”,
“agreementType”: “20”,
“eligibility”: {
“isEligible”: true,
“currentNumberOfAccounts”: 0,
“remainingNumberOfAccounts”: 10
}
}]
}
The above is the sample JSON
Following is the code which i have written
exec(
http(“Get proposals”)
.get( “/axxx/dd/xxx/”)
.check(status.is(200))
.transformResponse(Transformer.json)
.check(jsonPath("$…allowedToOpen").is(“true”),
jsonPath("$.payment[*]").ofType[Seq[Any]].findAll.saveAs(“pList”))
).foreach("${pList}", “accounts”) {
exec(
session => {
println(“Hello “+jsonPath(”${accounts.ean}”))
session
}
)}
After i get the response from the GET call i want to get the array of payment and based on the eligibility POST operation needs to be invoked. If someone can tell me how can i get the array of the payment in the foreach section then i can proceed ahead. I cannot find a way out.