DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
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).
1{{flatten nestedList}}| Parameter | Type | Description |
|---|---|---|
nestedList | Array | Required. 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.
1myArray = [[1, 2], [3, 4], [5]];To flatten the array, use the flatten function, as shown in this example.
1{{flatten myArray}}The function returns [1, 2, 3, 4, 5].