Skip to main content

Flatten List

Uncontrolled node

Overview

The Flatten List node is used to merge nested lists into a single list, removing layers of list nesting based on the specified depth.

This is especially useful when working with structured data like lists of lists—for example, output from a document reader, batch input, or grouped responses—and you want to simplify the structure for further processing.

Inputs

InputTypeDescriptionDefault
ListListA list of items, possibly containing other lists (nested lists)-

Outputs

OutputTypeDescription
OutputListA flattened list with nesting reduced to the specified depth

Panel Controls

The Depth field in the right-side panel controls how deeply the list is flattened.

  • A depth of 1 will flatten only the top-level of nesting.
  • A higher number will recursively flatten deeper layers.
  • If not specified, the default is 1.

Example: One-Level Flatten

If your list is:

[["a", "b"], ["c", "d"]]

and the depth is:

1

The output will be:

a,b,c,d

Tip

Use a higher depth when your data has multiple levels of nested lists. For most document or CSV outputs, a depth of 1 is usually enough.