Flatten
The flatten transform function converts structured, nested data into a new single-hierarchy-level structured data.
The names of the new fields are built by concatenating the intermediate level field names.
The step name is flatten
, and the UserConfig
is controlled here: UserConfig: {"steps": [{"type": "flatten"}]}
.
Parameters:
Parameter | Description |
---|---|
delimiter |
The delimiter to use when concatenating the field names (default: _) |
part |
when used with KeyValue data, defines if the transform function is done on the |
Example
-
Produce an AVRO message with the payload:
{field1: {field11: value11, field12: value12}}
.-
AVRO
-
Result
{"field1": {"field11": "value11", "field12": "value12"}}
{"field1_field11": "value11", "field1_field12": "value12"}
-
-
The function flattens the fields with the default
delimiter
between values, and outputs{field1_field11: value11, field1_field12: value12}
to the output topic.
What’s next?
For more, see Transform Functions or the Pulsar documentation.