Handlebars flatten
Handlebars flatten: flattens a nested list of lists into a single list.
Next
Runtime verified
Test scripts included
Flattens a nested list of lists into a single list.
Syntax
{{flatten nestedList}}
Returns array.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
nestedList |
array | Yes | A list that holds other lists. |
Example
Tested in Marketing Cloud Next emails on 2026-11-22 and 2026-11-25:
{{#if false}}{{flatten myList}}{{/if}}is accepted when the email is saved. The branch never runs, so the helper itself is not rendered.{{flatten (jsonpath '[[1,2],[3,4,5]]' "$")}}renders[1, 2, 3, 4, 5].{{#each (flatten (jsonpath '[[1,2],[3,4,5]]' "$"))}}[{{this}}]{{/each}}renders[1][2][3][4][5].
Show Next test script
Marketing Cloud Next
Works as documented
Rendered as documented on a nested list from jsonpath. Tested 2026-11-25 by rendering in a Marketing Cloud Next email.