Skip to content

#flatten

Returns a single array by recursively flattening an array of nested arrays.

#flatten(array)
Category Arrays and sequencesValid in Property value
Name Type Description
array path | array The nested array.

array

source.json
{
"nested": [ [ 1, [ 2 ] ], 3 ]
}
transformer.json
{
"result": "#flatten($.nested)"
}
output.json
{
"result": [ 1, 2, 3 ]
}

Try it in the playground →