Flatten

Jump to Section

The Flatten Stage can be used to compress a complex object hierarchy into an object that has attributes of simple types. During flattening the attribute path is used in the resulting attribute of the output object value. Flattening is applied recursively.

Stage Flatten

Delimiter

Delimiter to use between attributes when generating attribute names of the flattened object.

An example flatten operation is shown below

Flatten Input Event

json
{
 "machine": {
  "sensor1": {
   "v1": 1,
   "v2": 2.2
  },
  "sensor2": {
   "v1": 100,
   "v2": 20.2
  },
  "sensor3": {
   "v1": 1000,
   "v2": 2002.2
  }
 }
}

Flatten Output Event

json
{
 "machine/sensor1/v1": 1,
 "machine/sensor1/v2": 2.2,
 "machine/sensor2/v1": 100,
 "machine/sensor2/v2": 20.2,
 "machine/sensor3/v1": 1000,
 "machine/sensor3/v2": 2002.2
}