Handlebar Helper Function: Flatten

Transforms a list of lists into a flat list. This function is useful for normalizing nested data structures in templates.

This helper is available in the Winter ’26 release of Marketing Cloud Next (API version 65.0).

ParameterTypeDescription
nestedListArrayRequired. The list of lists to flatten.

The function returns a new list containing all elements from the nested lists. If the input isn’t a list of lists, or if a parameter is missing or an element isn’t a list, the function throws an exception.

This example shows how to use the flatten function to flatten this example array.

To flatten the array, use the flatten function, as shown in this example.

The function returns [1, 2, 3, 4, 5].