cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Simple Help With JSON Splitter

andre_mangatal
New Contributor

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โ€: โ€œโ€
}
]

image

3 REPLIES 3

andre_mangatal
New Contributor

image

image

tstack
Former Employee

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.

Hi tstack

I implemented what you told me and it worked! Thank you so, so very much

Best regards,
Andre