I want to compare two arrays and get only the common values in Mule 4 dataweave
Input:
array1 = ["aaa", "bbb"]
array2 = ["aaa","ccc","ddd"]
Output:
Result: ["aaa"]
I tried "--", diff but both didn't gave me expected result.
Thanks in advance
%dw 2.0
var array1 = ["aaa", "bbb"]
var array2 = ["aaa","ccc","ddd"]
output application/java
---
array1 reduce (item, acc = []) -> if (array2 contains item) acc + item else acc