Hi team,
script:
if(doc['charstream.keyword'].size() == 0){
return "null"
} else{
String[] parts = /\|/.split(doc['charstream.keyword'].value);
return parts[4];
}
Message string:
"charstream": "Content-Type: application/json\r\nIXC-Client-API-Type: REST-XML/HTTP\r\n\r\n{\"api_version\":\"1.2.0\",\"response_id\":\"BEFC9B92-F8C7-11EA-96EA-7F0001010000\",\"response_datetime\":\"2020-09-17T14:55:37.462+05:30\",\"request_id\":\"CD758BDD-C0A4-48AC-AF5D-BBD89646D196\",\"request_datetime\":\"2020-09-17T14:55:37.404+05:30\",\"sender_system_id\":\"Profunds\",\"sender_system_user_id\":\"abc@xyz.com\",\"request_priority\":\"3\",\"test_indicator\":\"false\",\"client_code\":\"ACMEX\",\"virtual_account_number\":\"****\",\"transaction_amount\":\"****\",\"currency_code\":\"INR\",\"payment_mode\":\"****\",\"transaction_id\":\"****\",\"transaction_id_type\":\"UTR\",\"transaction_datetime\":\"2020-09-17T14:50:27.404\",\"sender_name\":\"****\",\"sender_mobile_communication_number\":\"****\",\"sender_account_number\":\"****\",\"sender_bank_name\":\"****\",\"sender_ifsc_code\":\"****\",\"client_account_name\":\"****\",\"client_mobile_communication_number\":\"****\",\"client_account_number\":\"****\",\"client_bank_name\":\"****\",\"client_ifsc_code\":\"****\",\"narration_1\":\"Narration 1\",\"narration_2\":\"Narration 2\",\"informational_message\":\"A quick brown fox jumped over the lazy dog !\",\"completion_code\":0,\"reason_code\":\"XC00441I\",\"message\":\"Client has confirmed this transaction to be a valid one.\",\"client_data_ext\":{\"response_id\":\"727C43C3-8A4B-45CD-ABF2-5FFF564A9C77\",\"response_datetime\":\"2020-09-17T09:25:37.447Z\"}}"
output is:
[
{
"_id": "6doI03YBCWsN2ibkTlAi",
"amount": [
"null"
]
},
{
"_id": "ebH-HncBYnsBpTq8Oub_",
"amount": [
"null"
]
}
]
I need following fields from above JSON string:
- transaction_amount
- sender_name
- virtual_account_number
- sender_account_number
Can anyone has solution ?
Thanks