Skip to content

Flatten ​

What It Does ​

Flattens an array of arrays into a single level array, combining all nested elements into one unified list.

Inputs ​

NameDescriptionTypeRequired
arrayThe nested list to flattenListYes

Outputs ​

NameDescriptionType
arrayThe resulting flattened listList

Array flatten Example

How to Use It ​

  1. Drag the Array flatten node into your graph.
  2. Connect a nested list (like [[1, 2], [3, 4]]) to the "array" input.
  3. The node will output a single flattened list (like [1, 2, 3, 4]).

Tips ​

  • This node only flattens one level deep, not recursively through all nested arrays.
  • Make sure your input is actually an array of arrays, or the node will throw an error.

See Also ​

  • Arrify: For converting any value into an array format.
  • Concat: For joining multiple arrays together end-to-end.

Use Cases ​

  • Merging Token Groups: Combine nested token groups into a flat structure for easier processing.
  • Simplifying Data Structures: Convert complex nested lists of values into a simpler format for operations.
  • Processing Multi-dimensional Data: Transform grid-based data into a linear sequence for sequential processing.