Merge

The Merge function card merges two or more objects into a single object.

The output object contains all the keys and their assigned values that are present in the input objects.

If the same key appears in more than one input object, the only value retained in the output object is from the final object in the merge order.

Input

Field Definition Type Required

object 1

The first object to be merged.

Object

TRUE

object 2

The second object to be merged.

Object

TRUE

To add objects to the merge card, click the gray placeholder input or drop an object into it. After adding the new object, a new placeholder appears so you can add more objects.

Output

Field Definition Type

output

The merged object.

Object

Example

In this example, both objects have an email key, but contain different values. In the output object, the value for that duplicate key is taken from the last object in the merge order.

Input

  • object 1: { "email":"jane.doe@example.com", "id":123 }

  • object 2: { "email":"john.doe@example.com", "first":"John", "last":"Doe" }

Output

  • output: { "email":"john.doe@example.com", "id":123, "first":"John", "last":"Doe" }

If the merge order of the same objects is reversed, the output object changes accordingly. For the email key, the value from the second object replaces the value from the first object.

Input

  • object 2: { "email":"john.doe@example.com", "first":"John", "last":"Doe" }

  • object 1: { "email":"jane.doe@example.com", "id":123 }

Output

  • output: { "first":"John", "email":"jane.doe@example.com", "last":"Doe", "id":123 }

Related topics

Functions in Workflows

Workflow elements