Skip to main content

split

Split arrays, objects, or strings into separate individual messages.

Overview

The split node takes a single message containing an array, object, or string and splits it into a sequence of individual messages — one per element, key-value pair, or chunk. Each output message carries msg.parts metadata that allows a downstream join node to reassemble the sequence.

Array
Splitting
Object
Key/Value
String
Delimiter
Chunks
Fixed Length

Properties

Property Type Default Description
arraySplt string "," Delimiter for string splitting; ignored for array/object payloads
arraySpltType string "str" Delimiter type: "str" (string), "bin" (buffer), "len" (fixed length)
arraySpltLen number 1 Chunk size when using fixed-length splitting
stream boolean false Handle input as a stream (for Buffer/string payloads)

Split Modes

Array → Messages

Each element becomes a separate message

// Input:  [10, 20, 30]
// Output: msg1.payload = 10
//         msg2.payload = 20
//         msg3.payload = 30
// msg.parts.index = 0, 1, 2

Object → Key/Value

Each key-value pair becomes a message

// Input: { a: 1, b: 2, c: 3 }
// msg1: payload=1, msg.parts.key="a"
// msg2: payload=2, msg.parts.key="b"
// msg3: payload=3, msg.parts.key="c"

String by Delimiter

Split string on a character or substring

// arraySplt: "\n"
// Input: "line1\nline2\nline3"
// msg1.payload = "line1"
// msg2.payload = "line2"
// msg3.payload = "line3"

Fixed-Length Chunks

Split array into sub-arrays of N elements

// arraySpltLen: 2
// Input: [1, 2, 3, 4, 5]
// msg1.payload = [1, 2]
// msg2.payload = [3, 4]
// msg3.payload = [5]

Example: Split CSV Rows into Individual Messages

Process a CSV file by splitting each row into a separate message for parallel processing.

// Split node configuration
{
  "arraySplt": "\n",
  "arraySpltType": "str"
}

// Input message (CSV data as string)
{
  "payload": "device-01,23.5,65\ndevice-02,24.1,70\ndevice-03,22.8,58"
}

// Output: 3 separate messages
// msg1.payload = "device-01,23.5,65"
//   msg1.parts = { "id": "abc123", "index": 0, "count": 3, "type": "string", "ch": "\n" }
// msg2.payload = "device-02,24.1,70"
//   msg2.parts = { "id": "abc123", "index": 1, "count": 3, "type": "string", "ch": "\n" }
// msg3.payload = "device-03,22.8,58"
//   msg3.parts = { "id": "abc123", "index": 2, "count": 3, "type": "string", "ch": "\n" }

// Each can be parsed individually by a downstream function node

Example: Split Sensor Batch Readings

An MQTT message delivers a batch of readings — split them for per-sensor processing.

// Split node — default array split (no config needed for arrays)
{}

// Input: batch of sensor readings
{
  "topic": "sensors/batch",
  "payload": [
    { "id": "temp-01", "value": 23.5, "unit": "°C" },
    { "id": "hum-01",  "value": 65,   "unit": "%" },
    { "id": "pres-01", "value": 1013,  "unit": "hPa" }
  ]
}

// Output: 3 separate messages
// msg1.payload = { "id": "temp-01", "value": 23.5, "unit": "°C" }
// msg2.payload = { "id": "hum-01",  "value": 65,   "unit": "%" }
// msg3.payload = { "id": "pres-01", "value": 1013,  "unit": "hPa" }

// Each carries msg.parts for downstream join node reassembly

Common Use Cases

Batch Processing

Split batch API responses into individual items

CSV / Log Parsing

Split file content by lines or delimiters

Parallel Processing

Fan out messages for concurrent handling

Data Streaming

Break large payloads into manageable chunks

Related Nodes