Explode mode

Specify a field in an incoming Event that contains an array and Tines will emit individual Events for each element of the array.

Features 

  • Specify a field containing an array in an incoming Event.

  • A new Event will be emitted for each element of the array.

  • Specify the name of the key to hold the individual array elements in the emitted Event.

  • The newly emitted Event will also contain an index key describing the exploded element's position in the original array.

  • If the specified field is not a valid array, no Event will be generated.

Configuration Options 

  • mode: 'explode'.

  • path: When using 'explode' mode, define the wrapped JSON path for the field containing an array of elements to be emitted as individual events.

  • to: Specify the name of the field to contain the array of matches.

  • limit: (Optional) an integer representing the maximum number of events that can be emitted. Defaults to 500.

Emitted Events 

{
  "index": 0,
  "guid": "4bf6f75d-69dd-4fd5-8137-95b802ca9028",
  "users": {
    "name": "alice",
    "age": 85
  }
}

Example Configuration Options 

Given the incoming Event below, emit all elements from the 'numbers' array as separate Events in a field called "number".

{
  "numbers": [8, 13, 21]
}
{
  "mode": "explode",
  "path": "{{.numbers}}",
  "to": "number"
}

Given the incoming Event below, emit all elements from the 'people' array as separate Events in a field called "person".

{
  "numbers": [8, 13, 21],
  "people": [
    {
      "name": "Alice",
      "job": "Engineer",
      "language": "English"
    },
    {
      "name": "Bob",
      "job": "Student",
      "language": "English"
    }
  ]
}
{
  "mode": "explode",
  "path": "{{.people}}",
  "to": "person"
}