Open Navigation

Object Helper

Interact with objects


The Object Helper allows you to interact with objects

A good use of the Object Helpers connector is as a 'tidier' way of dealing with data from multiple steps - i.e. put it all into an object so that all subsequent steps can grab it from the single object helper step.

You can also use it to create an object from all the data you've been gathering and send it to another workflow, using the Callable Trigger

Basic Operations List

  • Add key/value pairs

  • Add value by key

  • Contains

  • Enforce object structure

  • Equals

  • Find Difference

  • Get value by key

  • Iterative transform

  • JSON Parse

  • JSON Stringify

  • Merge two objects

Example 1: Create and manipulate object

The following example creates an object and applies various transformations to illustrate how you can use the connector.

Create a connector with a Manual Trigger. Add an Object Helpers step set to Add value/ key pairs operation.

Create a new object by adding a property to the Source, for instance with property name name and any value you wish. Add a new item to the List parameter, as illustrated below (note we have switched to the Debug tab to view the output):


The result property in the output holds the newly created object.

Add a step with the operation set to Add value by key. We will use this to add another property to our object. Set the Object property to the result of the previous step, in Key enter the name for a new property to add to the object, and in Value specify its value:


The result property in the output will show the updated object.

We now use the Enforce object structure operation to enforce the structure of our object. Set the Object to the output of the previous step, change the field type of the Structure parameter to object, and set a couple of fields to check for:


We then use the Merge two objects operation to assign a value to the property created by the previous step. Change the type of Object two to object, add property with property name set to user_order, for instance. Set the new value for this property.


Finally, we use the Iterative transform operation to enforce the style of property keys and values. Set the Key transform parameter to "camelCase", and Value transform to Start Case as follows:


The result is an object in which all keys are camel cased and all string values are in start case.

Example 2: Take existing object and parse fields

In this example we take the output from another connector step and manipulate the object ready for importing into another connector in a Tray workflow.

Imagine a connector step which outputs the details of a person as:

"person": {
"emailAddress": "Tray Connectors <>",
"website": "",
"address": "1 sample street",
"city": "Sample city",
"zip": "12345"

But we have another connector step which requires input in the following format:

"person": {
"first_name": string,
"last_name": string,
"email_address": string,
"website": string,
"city": string,
"zip_code": string

We will use the Object Helpers to convert the first object into the following:

"person": {
"first_name": "Tray",
"last_name": "Connectors",
"email_address": "",
"website": "",
"city": "Sample city",
"zip_code": "12345"

The first step is to create a workflow. In this instance as we are creating an example, we will use the Script connector, set to the Execute Script operation, to generate a JSON object illustrative of connector output. In Script we enter

exports.step = function() {
return {
"emailAddress": "Tray Connectors <>",
"website": "",
"address": "1 sample street",
"city": "Sample city",
"zip": "12345"


Then we use the Iterative transform operation of the Object helpers to snake case all the property names, by setting Source object to the result of the previous step and Key transform to snake_case:


Next we use the Extract all by Regular Expression operation of the Text helpers to extract the first name, last name and email address from the email_address field by setting the Text to apply regex on to $.steps.object-helpers-1.result["email_address"], and the Regex field to /(.+?) (.+) <?(.+@.+[^>])>?$/:


Finally, we create a new object as our output with all the properties we wish to include by inserting an Object helpers step set to the Add key/value pairs operation, with the Source left as is (empty object). Then click Add item under the List parameter for each key/value pair to create in our output object (we have 5 properties).

There will be a new item for each of the following key/value pairs:

  • first_name: $.steps.text-helpers-1.result[0][1],
  • last_name: $.steps.text-helpers-1.result[0][2],
  • email_address: $.steps.text-helpers-1.result[0][3],
  • website:: $,
  • city: $,
  • zip_code: $


The output of this operation will be our final object.

Notes on operations usage

Enforce object structure

Defines a JSON structure which the output object must adhere to. For instance, given the Object {"name": "Tray"} and the Structure {"surname": "anyValue"} the result would be {"name": "Tray", "surname": null} as the operation forces Object to have the "surname" property even with a null value.

Object: (required) Object that should adhere to a structure.

Structure: (required) JSON structure that the output object must adhere to.

The property type for Object and Structure can either be Object or String (with valid JSON).

Merge two objects

Merges two objects. If a property is specified in both objects, the one specified in the second will be used. For instance, given Object {"name": "Foo", "surname": "io"} and Object two {"name": "Tray"}, the result would be {"name": "Tray", "surname": "io"}.

Object: (required) First object.

Object two: (required) Second object.

The property type for Object and Object two can either be Object or String (with valid JSON).

Was this article helpful?