Help Centre › Functions & Formulas
This article describes the RPA Data Format functionality to flatten nested JSON.
For a full list of available functions, please read DATA FORMAT functions.
Description
The Flatten JSON function converts a nested JSON object into a single-level object where keys represent the full path to each value, separated by a configurable separator.
Setting it up
To use the Flatten JSON function, follow these instructions:
{{popups:rpas/add:action=json-flatten}}
Once on a process map:
- Navigate to the process where you would like to add the Flatten 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 Flatten JSON option
- Click "Add" once you are done
Input parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
| Data | Yes | Text | - | The nested JSON data to flatten |
| Separator | No | Text | . | The separator to use between path segments in the flattened keys |
| Variable | No | Text | data | Variable name to store the flattened result |
Output variables
| Variable | Type | Description |
|---|---|---|
| {data} | Object | The flattened single-level JSON object |
Errors
| Error | Description |
|---|---|
| Invalid JSON | The data is not valid JSON |
Tips
- Useful for transforming nested API responses into flat rows for spreadsheets or databases
- Change the separator to use underscores or other characters if dots conflict with your data