I have a method named getPayDetails()
which return type is a string
pay.getPaymentDetails()
of which return type is a string and it returns the below string
[
{
"mcTtid":201657083281,
"cardLast4Digits":"0887",
"paymentType":"CREDIT CARD",
"originalPaymentCategory":{
"code":"Q",
"name":"CREDIT CARD"
}
},
{
"veTtid":21656148003,
"cardLast4Digits":"4777",
"paymentType":"GIFT CARD",
"originalPaymentCategory":{
"code":"Q",
"name":"GIFT CARD"
}
},
{
"mcTtid":201625819,
"cardLast4Digits":"8388",
"paymentType":"GIFT CARD",
"originalPaymentCategory":{
"code":"w",
"name":"GIFT CARD"
}
}
]
I need to extract the value of the attribute paymentType from the above string so the value of attribute paymentType in the above string is CREDIT CARD in a separate string variable. how can I do this?