02-12-2019 03:53 AM
Good day Snaplogic Community
This seems something simple but I am somewhat new to Snaplogic and I am returning a JSON from a REST GET which goes to a JSON Splitter with JSON path as $entity[*] but I would like to process each record in a mapper but I tried a couple expressions in the mapping input and it’s not working. If I have the JSON as below what would be is the expression for the expression field in the mapper be please? Thanks a lot in advance
[
{
“MPOS_Trans_ID”: 255,
“TransactionID”: “000000001”,
“GrandTotal”: 1,
“FullName”: “”,
“PolicyNo”: “”,
“Status”: 7,
“StatusName”: “NewUnprocessed”,
“RetryCount”: 0,
“ErrorMsg”: “”
},
{
“MPOS_Trans_ID”: 256,
“TransactionID”: “000000002”,
“GrandTotal”: 1,
“FullName”: “VISA ACQUIRER TEST/CARD 01”,
“PolicyNo”: “”,
“Status”: 7,
“StatusName”: “NewUnprocessed”,
“RetryCount”: 0,
“ErrorMsg”: “”
},
{
“MPOS_Trans_ID”: 257,
“TransactionID”: “000000003”,
“GrandTotal”: 5,
“FullName”: “”,
“PolicyNo”: “”,
“Status”: 7,
“StatusName”: “NewUnprocessed”,
“RetryCount”: 0,
“ErrorMsg”: “”
}
]
02-12-2019 03:56 AM
02-12-2019 08:07 AM
The expression in the screenshot is:
$entity.GrandTotal
However, after splitting on $entity[*]
, the documents will only have the contents of the elements of the array. So, you should not have to add the $entity
prefix and just write:
$GrandTotal
Although, I might not be understanding your question.
One thing I do notice though is that there doesn’t seem to be any preview documents generated in your screenshot? If there were some preview docs, it would be a lot easier to see what was working or not.
02-12-2019 08:36 AM
Hi tstack
I implemented what you told me and it worked! Thank you so, so very much
Best regards,
Andre