Unable to Fetch a value from the array

{
“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.

Can somebody explain how can i access $.payments as an array of objects and traverse via a loop on it.

I figured it out in which i converted the string to a JSON object using

val  parsed = JSON.parseFull(map.stripMargin)

If provides me the list of Maps and then i parsed it normally the scala way.