Skip to main content Skip to footer

Object To Array Documentation

Version: 1.0.0 

Retrieved: 2025-10-09 15:16:08


Object to Array

Converts an object to an array of objects. Each key-value pair in the incoming object becomes a separate object in the new array. Those new objects have two properties, one for the key and one for the value.

  • The key from the key-value pair becomes a value in the new object with Name Property as its key.
  • The value from the key-value pair becomes a value in the new object with Value Property as its key.

Note: The objects in the resulting array are in arbitrary order.

Possible errors

If the incoming object can't be converted to an array of objects, the module will warn and will not send a message to modules connected to it.

Settings

Name Requirements Purpose Default
Source property String 1-64 in length The property containing the object to convert data
Target property String 1-64 in length The property to write the array to data
Name property String 1-64 in length The name of the key property in the new objects key
Value property String 1-64 in length The name of the value property in the new objects value

Example

# Settings:
Source property = data
Target property = data
Name property = key
Value property = value

# Incoming messages:
{
  "data": {
      "machineId": 4126334,
      "temp": 34.7,
      "rpm": 12700
      "connected": true,
      "name": "MyMachine"
      "ignitionOrder": [1, 4, 3, 2]
  }
}

# Outgoing message:
{
    "data":[
        {"key": "machineId", value:4126334},
        {"key": "temp", value: 34.7},
        {"key": "rpm", value: 12700}
        {"key": "name", value: "MyMachine"}
        {"key": "connected", value: true}
        {"key": "ignitionOrder", value: [1, 4, 3, 2]}
    ]
}