Hi @Gabriele_Bracciali, I think the most readable way in n8n would be to use the Item Lists node to get the unique values from the EMAIL_CONTACT field, then a Set node using a bit of JMESPath logic to find the matching items from a previous node.
The full expression I’ve used here is {{ $jmespath($('Mock data').all(), "[?json.EMAIL_CONTACT=='" + $json.EMAIL_CONTACT + "'].json") }}, which might looks a bit weird at first. So let me try to break this down:
$jmespath(object, searchString) is the method used in n8n to access JMESPath. It requires one object (to which the filtering will be applied) and one string (which describes the filter).
$('Mock data').all() is our object and would simply be a method to retrieve all items (not just one) from the Mock data node in the example workflow.
"[?json.EMAIL_CONTACT=='" + $json.EMAIL_CONTACT + "'].json" is the string consisting of three parts joined using +. The middle part $json.EMAIL_CONTACT would read the value of the EMAIL_CONTACT for the current item (coming from our email lists node). For a value of [email protected], the full string would be "[?json.EMAIL_CONTACT=='[email protected]'].json". This is what JMESPath calls a filter projection and is explained here in their docs.
Hope this is roughly what you had in mind. Let me know if you have any questions on this