Object Node

The Object Node allows a workflow to perform operations against an Object or Array on the payload.

Object Node

Node Properties

Source Path

The Source Path is the location on the payload at which the node looks for an Array or Object.

Array Operations:

Object Operations:

If there is nothing at the given path, an empty object is created for the operation.

Operation

The operation is the instruction on how to manipulate the source. You must choose one of the following options.

Assign

The Assign operation asks for an object input, and then returns a new object that combines the source object and the input object. For example:

// Source
{ a: 1, b: 2 }

// Input Object
{ b: 4, c: 5 }

// Result
 { a: 1, b: 4, c: 5 }

If there are any matching keys between the source and the input object, assign will overwrite the value at that key in the source object with the value from the input object.

Entries

The Entries operation creates an array of key/value pairs from the source object.

// Source
{ a: 1, b: 2 }

// Result
[[a, 1], [b, 2]]

This operation is the inverse of the From Pairs operation.

From Pairs

The From Pairs operation creates an object from an array of key/value pairs.

// Source
[[a, 1], [b, 2]]

// Result
{ a: 1, b: 2 }

This operation is the inverse of the Entries operation.

Keys

The keys operation creates an array of the keys in the source object.

// Source
{ a: 1, b: 2 }

// Result
[a, b]

Merge Deep

The Merge Deep operation is used to combine two objects. It takes one argument: an input object, then returns a new object that combines the source and input object.

// Source
{ name: 'fred', age: 10, contact: { email: 'moo@example.com' }}

// Input Object
{ age: 40, contact: { phone: '111-222-3333' }}

// Result
{ name: 'fred', age: 40, contact: { email: 'moo@example.com', phone: '111-222-3333' }}

If there are objects as values at the same key, merge deep will also combine those objects.

Omit

The Omit operation takes one argument: an input array. It returns an object that removes any keys from the source object that are in the input array.

// Source
{a: 1, b: 2, c: 3, d: 4}

// Input Array
['a', 'd']

// Result
{b: 2, c: 3}

Pick

The Pick operation takes one argument: an input array. It returns an object that only contains keys from the source object that are also found in the input array.

// Source
{a: 1, b: 2, c: 3, d: 4}

// Input Array
['a', 'd']

// Result
{a: 1, d: 4}

Values

The Values operation takes no arguments. It creates an array of values found in the source object.

// Source
{a: 1, b: 2, c: 3}

// Result
[1, 2, 3]

Zip Object

The Zip Object operation takes one argument: an input array. It returns an object that contains the values from the source array as keys and values from the input array as values. If the given arrays are of different lengths the resulting object will only contain as many keys as the shorter of the two arrays.

// Source Array
['a', 'b', 'c']

// Input Array
[1, 2, 3]

// Result
{ a: 1, b: 2, c: 3 }

Note: For Edge Workflows, this operation is only available in GEA version 1.30.0 or higher.

Destination Path

If the chosen operation modifies the original object, you must give a destination path for the new object.

Node Example

Given the following source object and the “Values” operation:

{
  "voltage": 1.7,
  "color": 1393,
  "devices": ["5f2ae2b0a4babd0007a28e3e", "5f23300913f7f30006a331b2"]
}

The resulting array placed at the indicated output path looks like this:

[1.7, 1393, ["5f2ae2b0a4babd0007a28e3e", "5f23300913f7f30006a331b2"]]

Node Errors

In most cases, invalid data in the object is handled by returning an empty object. In the case that a required field is missing or contains an invalid value, an error halts the current workflow.

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.