Array node

Array Flatten

Flatten one level of nested arrays into a single array. Sub-arrays are expanded in place; non-array elements pass through unchanged. Useful for unpacking zipped data or merging nested structures.

Inputs

PortType
ArrayA list that contains other lists. One level of nesting is unwrapped; plain elements pass through untouched.any

Outputs

PortType
Resultany
Countint

How It Works

Array Flatten iterates through the input array. For each element that is itself an array, its contents are expanded in place at that position. Non-array elements pass through unchanged. Only one level of nesting is removed per pass.

Example: [[1, 2], 3, [4, 5]] → [1, 2, 3, 4, 5]

Use Cases

  • Unzipping: Flatten an Array Zip result to get a single flat interleaved array.
  • Chunk reassembly: Flatten chunked data back into a single continuous array.
  • Structure unpacking: Expand nested data from JSON parsing into a flat array for processing.

Tips

  • Only one level of nesting is removed. For deeply nested structures, chain multiple Array Flatten nodes.
  • To check if flattening is needed, compare Array Length before and after — if the counts differ, nesting was present.

Open Array Flatten in the interactive catalog →

Array Flatten is one of 381 nodes in Grafit Pro.

Free download. Every feature for 7 days, no card. Then €99.99 once — or keep playing your projects as a Player.

More Array nodes