Mule 4 – How to iterate over Map entries

We know that Mule 4 comes with DataWeave as the default expression language. Mule 4 with DataWeave is very powerful. If we need to iterate the list, then we know that we can use <foreach> component. It was available in Mule 3 and it is available in Mule 4 as well. You can refer the this documentation to understand the difference.

We have so many examples for iterating over List, but let’s say we need to iterate over Map entries. Is it possible? Of course it is possible!! Thanks to DataWeave. We can use DataWeave entrySet function in this case. Here is the complete example.

Output:

 

Leave a Reply

Your email address will not be published. Required fields are marked *