Forum Discussion

aditya_gupta41's avatar
aditya_gupta41
Contributor
2 years ago

Filtering Objects

Hello Experts,

I have below Object input containing string values. Can someone please provide expression to get rid of duplicate values?

[ { "ack": { "QueueURL": "https://www.google.com", "ReceiptHandle": "12345678", "content": "ABCDEFG" } }, { "ack": { "QueueURL": "https://www.google.com", "ReceiptHandle": "12345678", "content": "ABCDEFG" } }, { "ack": { "QueueURL": "https://www.google.com", "ReceiptHandle": "12345678", "content": "ABCDEFG" } } ]

Thanks in Advance

3 Replies

  • If this document is the input to an Ultra task, you could use the following expression in a Mapper snap:

    $.filter((val,idx,arr) => arr.findIndex(x=> x == val) == idx)

    Basically, it scans through the Array and finds the first occurrence of the given value (object).