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.

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.