unnest

utility

Unnests/flattens nested structures

Syntax

unnest(array)

Parameters

array (array)

The nested array or structure to flatten

Returns

array

Flattened array with nested elements expanded

Examples

Unnest order items
Input:
map(.items) | unnest
Output:
[{item: "a"}, {item: "b"}, {item: "c"}]
Flatten nested data
Input:
.nested_data | unnest
Output:
[1, 2, 3, 4, 5]

The unnest() function flattens nested array structures, expanding nested elements into individual rows.

Usage

Use unnest() to expand nested JSON arrays, flatten hierarchical data, or convert nested structures into flat tables.

Related Functions