Skip to content

Flatten

Flatten nested JSON Objects and Arrays into a single JSON Object containing only top-level fields.

Transform json

actions:
- flatten:
fields:
all-fields: false
JSON
{
"actions": [
{
"flatten": {
"fields": {
"all-fields": false
}
}
}
]
}

A ✓ marks a field that accepts a context variable such as {{ VARIABLE }}.

Field Type Required Description
description string describe this step.
condition lua-expression (string) Only run this action if the specified condition is met.
Examples: 2 * count()
fields Fields The fields that should be flattened (all or a subset).
Allowed values: all-fields, subset
preserve-empty-arrays boolean (bool) Preserve empty arrays.
Default: true
preserve-empty-objects boolean (bool) Preserve empty objects.
Default: true
separator string Set the string to separate keys in the flattened object.
Option Name Type Description
all-fields All Fields bool Flatten all fields.
Default: false
subset Subset string[] Flatten just these fields.