Help Centre › Functions & Formulas
This article describes the RPA Data Format functionality to merge two JSON objects.
For a full list of available functions, please read DATA FORMAT functions.
Description
The Merge JSON function merges two JSON objects together. When keys conflict, the override object wins. With deep merge enabled, nested objects are merged recursively.
Setting it up
To use the Merge JSON function, follow these instructions:
{{popups:rpas/add:action=json-merge}}
Once on a process map:
- Navigate to the process where you would like to add the Merge JSON function
- Click on the green button’s drop-down (right side of the green button labelled “Process”)
- On the menu that appears, click on the “+ Activity” item
- From here you can select the DATA FORMAT Merge JSON option
- Click "Add" once you are done
Input parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
| Base | Yes | Text | - | The base JSON object |
| Override | Yes | Text | - | The JSON object to merge into the base (wins on conflicts) |
| Deep | No | Boolean | true | Whether to merge nested objects recursively |
| Variable | No | Text | data | Variable name to store the merged result |
Output variables
| Variable | Type | Description |
|---|---|---|
| {data} | Object | The merged JSON object |
Errors
| Error | Description |
|---|---|
| Invalid JSON | One or both inputs are not valid JSON |
Tips
- The override object wins on key conflicts
- Set deep to true to merge nested objects recursively instead of replacing them