Skip to content

Flatten

Flatten (flatten)

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

Transform json

Minimal example

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

Contents

Fields

FieldTypeRequiredDescription
fieldsFieldsThe fields that should be flattened (all or a subset).
descriptionstringdescribe this step.
conditionlua-expression (string)Only run this action if the specified condition is met.
Examples: 2 * count()
preserve-empty-arraysboolean (bool)Preserve empty arrays.
preserve-empty-objectsboolean (bool)Preserve empty objects.
separatorstringSet the string to separate keys in the flattened object.

Schema

Fields Options

OptionNameTypeDescription
all-fieldsAll FieldsboolFlatten all fields.
subsetSubsetstring[]Flatten just these fields.