Overview
The change node modifies message properties without writing code.
Set values, change existing properties, delete unwanted data, or move properties around.
Supports JSONata expressions for complex transformations.
Set
Assign Values
Change
Find & Replace
Delete
Remove Props
Move
Reorganize
Properties
| Property | Type | Default | Description |
|---|---|---|---|
| rules | array | [] | Array of change operations |
Operations
Set
Assign a value to a property
// Set msg.payload to "hello"
// Set msg.topic to flow.device_id
// Set msg.timestamp to $now() Change
Find and replace within a property
// Change "temp" to "temperature"
// Replace regex /\s+/g with " "
// Change "," to "." in payload Delete
Remove a property from the message
// Delete msg.password
// Delete msg._private
// Delete msg.payload.debug Move
Move or rename a property
// Move msg.data to msg.payload
// Move msg.temp to msg.sensors.temperature
// Move msg.raw to msg._backup Value Types
| Type | Description | Example |
|---|---|---|
| str | String value | "hello world" |
| num | Number value | 42, 3.14 |
| bool | Boolean value | true, false |
| json | JSON object/array | {"a": 1}, [1, 2, 3] |
| msg | Message property | msg.topic, msg.payload.id |
| flow | Flow context | flow.deviceId |
| global | Global context | global.settings |
| env | Environment variable | $API_KEY, $NODE_ENV |
| jsonata | JSONata expression | $now(), payload.items[0] |
Example: Sensor Data Normalization
Transform raw sensor data into a standardized format.
// Change node rules:
[
// Move raw value to payload.raw
{ "t": "move", "p": "payload", "to": "payload.raw" },
// Set normalized structure
{ "t": "set", "p": "payload.value", "to": "payload.raw.reading", "tot": "msg" },
{ "t": "set", "p": "payload.unit", "to": "°C", "tot": "str" },
{ "t": "set", "p": "payload.deviceId", "to": "device_001", "tot": "flow" },
// Add timestamp using JSONata
{ "t": "set", "p": "payload.timestamp", "to": "$now()", "tot": "jsonata" },
// Delete sensitive data
{ "t": "delete", "p": "payload.raw.apiKey" }
] Example: JSONata Transformations
Use JSONata for complex data transformations.
// JSONata expressions in change node:
// Calculate average of array
{ "t": "set", "p": "payload.average",
"to": "$average(payload.readings)", "tot": "jsonata" }
// Format date
{ "t": "set", "p": "payload.dateFormatted",
"to": "$fromMillis($now(), '[Y]-[M01]-[D01]')", "tot": "jsonata" }
// Filter and transform array
{ "t": "set", "p": "payload.activeDevices",
"to": "payload.devices[status='active'].{\"id\": id, \"name\": name}",
"tot": "jsonata" }
// Conditional value
{ "t": "set", "p": "payload.status",
"to": "payload.temperature > 30 ? 'hot' : 'normal'", "tot": "jsonata" } Common Patterns
Add Timestamp
Set msg.timestamp
to: $now()
type: jsonata Rename Property
Move msg.temp
to: msg.temperature Copy Topic to Payload
Set msg.payload.source
to: msg.topic
type: msg Strip Sensitive Data
Delete msg.payload.password
Delete msg.payload.token
Delete msg.payload.apiKey