DataWeave : map()
The map is a function in Dataweave which iterates over the items in an array and outputs them into a new array.
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.
multiplying item with it’s index:
iterating with default symbols ($,$$)
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
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 https://dw.hashnode.dev.