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 test script for the flatten helper. Paste it into the HTML component of a
     Next email and open the preview. Each line prints the result Next gave when the call
     was rendered on its own (expect) next to the result of this run (got).
     Assembled from single-call test emails (dates on the page); it has not been
     run as one email. Calls that make Next fail are listed separately. -->
<p>c1 expect=[gated] got=[{{#if false}}{{flatten probeList}}{{/if}}gated]</p>
<p>c2 expect=[[1][2][3][4][5]] got=[{{#each (flatten (jsonpath '[[1,2],[3,4,5]]' "$"))}}[{{this}}]{{/each}}]</p>
<p>c3 expect=[[1, 2, 3, 4, 5]] got=[{{flatten (jsonpath '[[1,2],[3,4,5]]' "$")}}]</p>

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.

See also