Going Stellar

Home/Smart values reference

Jira Automation smart value

flatten() in Jira Automation: syntax and examples

flatten() merges a nested list into a one-dimensional list. A list of lists appears when a text function such as split() runs on every item of a list, or when a webhook delivers nested data.

Syntax

{{list.flatten()}}

Works on

  • Fields: a list whose items are themselves lists, such as comment bodies after split().
  • Returns: one flat list.

Examples

{{issue.comments.body.split(" ")}}

Split every comment into words. The result is one list of words per comment.

Result:

[First, comment, from, QA], [Second, comment:, fixed, in, build, 42]

Run on Jira Cloud on .

{{issue.comments.body.split(" ").flatten()}}

Merge the two word lists into one.

Result:

First, comment, from, QA, Second, comment:, fixed, in, build, 42

Run on Jira Cloud on .

{{issue.comments.body.split(" ").size}}

Without flatten the size counts the inner lists, one per comment.

Result:

2

Run on Jira Cloud on .

{{issue.comments.body.split(" ").flatten().size}}

After flatten the size counts every word of every comment.

Result:

10

Run on Jira Cloud on .

{{issue.comments.body.split(" ").flatten().join("_")}}

Chain join() to print all the words of all comments as one token.

Result:

First_comment_from_QA_Second_comment:_fixed_in_build_42

Run on Jira Cloud on .

Pitfalls

  • The Atlassian example reads data from webhookData. In a rule with a manual trigger there is no webhook data, and the smart value renders an empty string instead of the numbers (checked on Jira Cloud, November 2026). It only returns data in a rule started by an incoming webhook.
  • A list printed without flatten shows its inner lists in square brackets. That is the signal that a text function ran on every item and that you need flatten() before counting or joining.
  • On a list that is already flat, such as the labels, flatten() changes nothing.

Sources

  1. Jira smart values: lists (Atlassian Support)
  2. Jira smart values: JSON functions (Atlassian Support)

Markdown version · All smart values