cancel
Showing results for 
Search instead for 
Did you mean: 

Filtering Objects

aditya_gupta41
Contributor

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 3

koryknick
Employee

@aditya_gupta41 - have you tried the Unique snap?

aditya_gupta41
Contributor

@koryknick This is suppose to be an ultra task, therefore can’t use unique snap

koryknick
Employee

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).