flatten()

Takes out all elements of the recursively nested array and converts them to a flatten array. Otherwise, it returns the input value as it is. This is used to convert nested array elements to a single array before merging an array into a single string using strjoin().

Syntax

flatten(ARRAY_EXPR)
Required Parameter
ARRAY_EXPR
Expression that returns the value to be converted to a single array

Usage

json "{}" 
| eval array=flatten(array(1, array(2, 3), 4))
=> [ 1, 2, 3, 4 ]