โ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