The json I have looks like this:
{
"cards": [
{
"card_id":"1234567890",
"card_status":"active",
"card_expiration":{
"formatted":"01/20"
},
"debit":{
"masked_debit_card_number":"1111 **** **** 1111",
}
},
{
"card_id":"1234567891",
"card_status":"active",
"card_expiration":null,
"debit":{
"masked_debit_card_number":"2222 **** **** 2222",
}
}
]
}
I'm trying to retrieve all card_expiration
fields values using this function:
def getExpirations(json: Json) =
root
.cards
.each
.filter(root.card_status.string.exist(_ == "active"))
.card_expiration
.selectDynamic("formatted")
.string
.getAll(json)
The thing is, the above expression only returns 1 result - for the first card, but I really need to get something like List(Some("01/20"), None)
! What can I do in this situation?