DataWeave 2.0 core functions cheatsheet

Updated: Mar 16

This is a compilation of all the core functions that can be used in DataWeave 2.0 according to MuleSoft's official documentation, separated by input and output.


The link to each function's official documentation page is provided in the list. There you can find more details about the functions and examples on how to use them.


You can use ctrl+F or cmd+F to search for specific keywords and get to the function you're looking for.



List of functions


Array to Array

Input: Array

Output: Array

  • Plus plus (++) - Concatenates two arrays into a new array.

  • Minus minus (--) - Removes items listed in the second array from the first array.

  • distinctBy - Iterates over an array and returns the unique elements in it.

  • filter - Iterates over an array and returns the matching values from a given expression.

  • find - Returns an array with the indices (or indexes) of the elements from the array that matched a specific value.

  • flatMap - Iterates over each item in an array and flattens the results.

  • flatten - Turns a set of subarrays into a single, flattened array.

  • map - Iterates over items in an array and outputs the result into a new array.

  • maxBy - Iterates over the array and returns the highest array according to the provided expression.

  • minBy - Iterates over the array and returns the lowest array according to the provided expression.

  • orderBy - Reorders the array's elements based on the given criteria.

  • reduce - Applies a reduction expression to the elements in the array.

  • unzip - Groups the values of the given sub-arrays by matching indices (or indexes) and returns new sub-arrays with the matching indices. Note: performs the opposite of zip.

  • zip - Merges elements from two arrays into an array of arrays. Note: performs the opposite of unzip.


Array to Boolean

Input: Array

Output: Boolean

  • contains - Returns true if the array contains a given value, otherwise false.

  • isEmpty - Returns true if the array is empty, otherwise false.

  • max - Returns the highest boolean in the given array.

  • maxBy - Iterates over the array and returns the highest boolean according to the provided expression.

  • min - Returns the lowest boolean in the given array.

  • minBy - Iterates over the array and returns the lowest boolean according to the provided expression.

  • reduce - Applies a reduction expression to the elements in the array.


Array to Date

Input: Array

Output: Date

  • max - Returns the highest date in the given array.

  • maxBy - Iterates over the array and returns the highest date according to the provided expression.

  • min - Returns the lowest date in the given array.

  • minBy - Iterates over the array and returns the lowest date according to the provided expression.


Array to DateTime

Input: Array

Output: DateTime

  • max - Returns the highest datetime in the given array.

  • maxBy - Iterates over the array and returns the highest datetime according to the provided expression.

  • min - Returns the lowest datetime in the given array.

  • minBy - Iterates over the array and returns the lowest datetime according to the provided expression.


Array to LocalDateTime

Input: Array

Output: LocalDateTime

  • max - Returns the highest localdatetime in the given array.

  • maxBy - Iterates over the array and returns the highest localdatetime according to the provided expression.

  • min - Returns the lowest localdatetime in the given array.

  • minBy - Iterates over the array and returns the lowest localdatetime according to the provided expression.


Array to LocalTime

Input: Array

Output: LocalTime

  • max - Returns the highest localtime in the given array.

  • maxBy - Iterates over the array and returns the highest localtime according to the provided expression.

  • min - Returns the lowest localtime in the given array.

  • minBy - Iterates over the array and returns the lowest localtime according to the provided expression.


Array to Number

Input: Array

Output: Number

  • avg - Returns the average of numbers listed in the array.

  • max - Returns the highest number in the given array.

  • maxBy - Iterates over the array and returns the highest number according to the provided expression.

  • min - Returns the lowest number in the given array.

  • minBy - Iterates over the array and returns the lowest number according to the provided expression.

  • reduce - Applies a reduction expression to the elements in the array.

  • sizeOf - Returns the number of elements in an array.

  • sum - Returns the sum of numeric values in the given array.


Array to Object

Input: Array

Output: Object

  • groupBy - Returns an object that groups items from an array based on specific criteria.

  • maxBy - Iterates over the array and returns the highest object according to the provided expression.

  • minBy - Iterates over the array and returns the lowest object according to the provided expression.

  • reduce - Applies a reduction expression to the elements in the array.


Array to String

Input: Array

Output: String

  • joinBy - Merges the array into a string and uses the provided string as separator between each item. Note: this is the opposite operation of splitBy.

  • max - Returns the highest string in the given array.

  • maxBy - Iterates over the array and returns the highest string according to the provided expression.

  • min - Returns the lowest string in the given array.

  • minBy - Iterates over the array and returns the lowest string according to the provided expression.

  • reduce - Applies a reduction expression to the elements in the array.


Array to Time

Input: Array

Output: Time