I have a JSON variable and can't get the data in the second dimension. How can I retrieve for example the value of the key='TransactionAmount' in the below code using php?
I can retrieve the transactionid, resultdescription.
$json = {
"Result": {
"ResultType": 0,
"ResultCode": 0,
"ResultDesc": "The service request is processed successfully.",
"OriginatorConversationID": "2159-1931249-1",
"ConversationID": "AG_20190925_0000425ed57b5e1fee9b",
"TransactionID": "NIP21HAIT2",
"ResultParameters": {
"ResultParameter": [{
"Key": "TransactionReceipt",
"Value": "NIP21HAIT2"
}, {
"Key": "TransactionAmount",
"Value": 500
}, {
"Key": "B2CWorkingAccountAvailableFunds",
"Value": 350000.00
}, {
"Key": "B2CUtilityAccountAvailableFunds",
"Value": 5134.00
}, {
"Key": "TransactionCompletedDateTime",
"Value": "25.09.2019 18:30:23"
}, {
"Key": "ReceiverPartyPublicName",
"Value": "254708374149 - John Doe"
}, {
"Key": "B2CChargesPaidAccountAvailableFunds",
"Value": -440.00
}, {
"Key": "B2CRecipientIsRegisteredCustomer",
"Value": "Y"
}]
},
"ReferenceData": {
"ReferenceItem": {
"Key": "QueueTimeoutURL",
"Value": "https:\/\/internalsandbox.safaricom.co.ke\/mpesa\/b2cresults\/v1\/submit"
}
}
}
}