---
title: "flatten function in Strata | Oplema"
description: "Flatten a nested list by one level, turning a list of lists into a single list. Write it as flatten(nested_list) in a Strata Formula or Filter."
url: "https://oplema.com/docs/strata/functions/flatten"
updated: "2026-11-04"
---

# flatten

Merge a list of lists into one list, removing one level of nesting.

## Try an expression

In [Formula](https://oplema.com/docs/strata/prep/formula), enter the expression and set Output type to **VARCHAR**.

### Expression

```
flatten([[1, 2, 3], [4, 5]])
```

### Result

```
'[1, 2, 3, 4, 5]'
```

The expression returns `INTEGER[]`. Formula stores it as `VARCHAR` in this example. To use your own data, replace the example values with column names. Keep format strings and other options as written.

Try it live in Formula

Result
| id | result |
| --- | --- |
| 1 | \[1, 2, 3, 4, 5\] |

## Arguments and types

```
flatten(nested_list)
```

**nested\_list**

List

Supported signatures (1)

```
flatten(nested_list: T[][]) → T[]
```

The result type can depend on the input types. See DuckDB for the full argument rules.

## Things to know

If the first argument is missing, the result is NULL.

## Related functions

[array\_pop\_back

Remove the last value from a list.

](https://oplema.com/docs/strata/functions/array-pop-back)[array\_pop\_front

Remove the first value from a list.

](https://oplema.com/docs/strata/functions/array-pop-front)[array\_push\_front

Add a value at the beginning of a list.

](https://oplema.com/docs/strata/functions/array-push-front)[array\_to\_string

Join the values in a list into one string using a separator.

](https://oplema.com/docs/strata/functions/array-to-string)

[Browse lists & arrays](https://oplema.com/docs/strata/functions#lists-&-arrays) [DuckDB documentation](https://duckdb.org/docs/current/sql/functions/list.html#flattennested_list)

Function metadata from DuckDB, used under the [MIT license](https://github.com/duckdb/duckdb/blob/v1.5.4/LICENSE).
