DataWeave : map()

map() :

The map is a function in Dataweave which iterates over the items in an array and outputs them into a new array.

map(item,index) :

item (default $): it represents the element in the input array list.

index (default $$) : it represents the position of the element the input array list.

map function is only applicable for an arrays

It basically accepts input as a list of items in an array and transforms the items in the array in order to form a new array as an output.

Example 1:

multiplying item with it’s index:

Example 2:

iterating with default symbols ($,$$)

ex1 :


Example 3 :

transforming employee data:
condition 1: employee id as key.
condition 2: value is combination of first and last name.

Note : Whenever we are applying map function other than an arrays we get the exception

Example 4:

Thank you for taking out time to read the above post. Hope you found it useful. In case of any questions, feel free to comment below. Also, if you are keen on knowing about a specific topic, happy to explore your recommendations as well.

#mulesoft #dataweave #dw #anypointstudio #mule #muleEsb #map#map()

Originally published at




Love podcasts or audiobooks? Learn on the go with our new app.

Cracking The Zed Run Code Giveaway

Simple toString() method for Binary Search Trees

Exploring Creative Code: Week One

3 Questions to Answer Before Implementing Any Mobile App Idea.

Get 5 Free Sticker Slots Without Any Boosts on Discord

Swift Grand Central Dispatch Part 1

Authenticate Django Apps with Another Django App Hosted Separately

Announcing the Final Plasm Testnet to Explore Rococo V1

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


More from Medium

CS373 Spring 2022 Ricky Woodruff — Blog 4

CS 373 Spring 2022: Stacy Jong

Applications Of CPM And PERT

How I got into Red Hat, Part 6