Contact Free trial Login

flatten

flatten(Array<Array<T> | Q>): Array<T | Q>

Flattens an array of arrays into a single, simple array.

Example

This example flattens an array of arrays.

Source

%dw 2.0
output application/json
---
flatten(payload)

Input

[
   [3,5],
   [9,5],
   [154,0.3]
]

Output

[
  3,
  5,
  9,
  5,
  154,
  0.3
]

flatten(Null): Null

Helper function that allows flatten to work with null values.