Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 05-10-2022 05:49 AM
Hi,
Please, is there a way to reference a key part of JSON file that can come in different structures.
For example i want to get the value of "requestUid" from these different JSON structures just with a single processor. So, irrespective of JSON formats or structures sent, i would want to get the value of requestUid.
Thanks.
For example:
1)
{
"responseMetaData": {
"type": "ACK",
"userId": "SYSTEM",
"requestUid": "1742963e-f02f-4db6-88e0-6af8c4d4825b",,
"systemId": "CIF",
"serviceId": "FR_CUS"
},
"responseDataObject": {
"result": "Accepted",
"responseCode": "SUC",
"responseMessage": "",
"execTime": "1216"
}
}
2)
{
"responseMetaData": {
"type": "ACK",
"sendTime": "23/03/2019 09:16:25.305277",
"timeZone": "4",
"userId": "SYSTEM",
"branchCompanyId": "784100",
"branchLocationId": "784101",
"systemId": "CIF",
"serviceId": "FR_CUS"
},
"responseDataObject": {
"result": "Accepted",
"responseCode": "SUC",
"requestUid": "yywhhnan56289200200",
"execTime": "1216"
}
}
Created 05-10-2022 12:31 PM
Not sure if this is the the most efficient way, but you can use ExtractText by creating new attribute with the following regular expression:
(?<=\"requestUid\":\s")[A-Z-a-z-0-9\-]+
Not sure if you can accomplish that using evaluatejsonPath processor, but given that the path can be different its probably hard to accomplish
Created 05-10-2022 12:31 PM
Not sure if this is the the most efficient way, but you can use ExtractText by creating new attribute with the following regular expression:
(?<=\"requestUid\":\s")[A-Z-a-z-0-9\-]+
Not sure if you can accomplish that using evaluatejsonPath processor, but given that the path can be different its probably hard to accomplish
Created 05-10-2022 01:00 PM
Hi SAMSAL,
Thank you so much. I got it working using your method at the moment.
Please, can you explain this RE to me or point me to a suitable material where i can learn this particular Regular Expression.
I really appreciate.
Created 05-10-2022 01:15 PM
There is a lot of articles\videos around learning Regular Expression. The one I provided using what is called positive lookbehind (?<=), which means: find the Id which contain alphanumeric characters with hyphen (-) that is proceeded (lookbehind) with the text "requestUid"
Created 05-10-2022 01:53 PM
Thank you.