# Flatten struct
> Supported in: Batch, Faster, Streaming
Take all fields in a struct and turn them into columns in the output dataset.
**Transform categories**: Struct
## Declared arguments
* **Dataset:** Dataset containing struct column.
*Table*
* **Expression:** Expression evaluating to a struct column that will be flattened.
*Expression\*
* **Max depth:** The depth level specifying how deep a nested struct will be flattened.
*Literal\*
* *optional* **Column prefix:** Add a prefix to all columns created during the flatten.
*Literal\*
* *optional* **Separator:** Separate field names coming from nested structs.
*Literal\*
## Examples
### Example 1: Base case
**Argument values:**
* **Dataset:** ri.foundry.main.dataset.a
* **Expression:** `raw`
* **Max depth:** 2
* **Column prefix:** new\_
* **Separator:** *null*
**Input:**
| raw |
| ----- |
| {
**airline**: {
**id**: NA,
**name**: new air,
},
**tail\_no**: NA-123,
} |
| {
**airline**: {
**id**: FA,
**name**: foundry airways,
},
**tail\_no**: FA-123,
} |
**Output:**
| new\_airline\_name | new\_airline\_id | new\_tail\_no | raw |
| ----- | ----- | ----- | ----- |
| new air | NA | NA-123 | {
**airline**: {
**id**: NA,
**name**: new air,
},
**tail\_no**: NA-123,
} |
| foundry airways | FA | FA-123 | {
**airline**: {
**id**: FA,
**name**: foundry airways,
},
**tail\_no**: FA-123,
} |
***
### Example 2: Base case
**Argument values:**
* **Dataset:** ri.foundry.main.dataset.a
* **Expression:** `raw`
* **Max depth:** 2
* **Column prefix:** new\_
* **Separator:** *SEPARATOR*
**Input:**
| raw |
| ----- |
| {
**airline**: {
**id**: NA,
**name**: new air,
},
**tail\_no**: NA-123,
} |
| {
**airline**: {
**id**: FA,
**name**: foundry airways,
},
**tail\_no**: FA-123,
} |
**Output:**
| new\_airline\_SEPARATOR\_name | new\_airline\_SEPARATOR\_id | new\_tail\_no | raw |
| ----- | ----- | ----- | ----- |
| new air | NA | NA-123 | {
**airline**: {
**id**: NA,
**name**: new air,
},
**tail\_no**: NA-123,
} |
| foundry airways | FA | FA-123 | {
**airline**: {
**id**: FA,
**name**: foundry airways,
},
**tail\_no**: FA-123,
} |
***
### Example 3: Null case
**Argument values:**
* **Dataset:** ri.foundry.main.dataset.a
* **Expression:** `raw`
* **Max depth:** 2
* **Column prefix:** new\_
* **Separator:** *null*
**Input:**
| raw |
| ----- |
| *null* |
| {
**airline**: *null*,
**tail\_no**: NA-123,
} |
| {
**airline**: {
**id**: FA,
**name**: *null*,
},
**tail\_no**: FA-123,
} |
**Output:**
| new\_airline\_name | new\_airline\_id | new\_tail\_no | raw |
| ----- | ----- | ----- | ----- |
| *null* | *null* | *null* | *null* |
| *null* | *null* | NA-123 | {
**airline**: *null*,
**tail\_no**: NA-123,
} |
| *null* | FA | FA-123 | {
**airline**: {
**id**: FA,
**name**: *null*,
},
**tail\_no**: FA-123,
} |
***