Help Centre › Functions & Formulas
This article describes the RPA Data Format functionality to convert XML to JSON.
For a full list of available functions, please read DATA FORMAT functions.
Description
The XML to JSON function converts an XML string into a JSON object. XML attributes are converted to keys prefixed with @.
Setting it up
To use the XML to JSON function, follow these instructions:
{{popups:rpas/add:action=xml-to-json}}
Once on a process map:
- Navigate to the process where you would like to add the XML to 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 XML to JSON option
- Click "Add" once you are done
Input parameters
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
| Data | Yes | Text | - | The XML string to convert |
| Variable | No | Text | json | Variable name to store the JSON output |
Output variables
| Variable | Type | Description |
|---|---|---|
| {json} | Object | The JSON representation of the XML data |
Errors
| Error | Description |
|---|---|
| Invalid XML | The data is not valid XML |
Tips
- XML attributes become @attr keys in the JSON output
- Use json-query after conversion to navigate the resulting JSON