Create a custom object (variable) from JSON data
In Power Automate Desktop, you add actions by dragging and dropping them in the GUI, but internally, flows are built in a programming language called Robin.
Because of this, variables have several data types, and you can handle JSON data flexibly.
This article explains how to create a custom object with multiple properties from JSON data.
Details of the “Convert JSON to custom object” action
Section titled “Details of the “Convert JSON to custom object” action”This article uses the “Convert JSON to custom object” action.
The action has the following parameters.
| Parameter | Value |
|---|---|
| JSON | A string of the target JSON data |
| Variables produced | The variable name of the custom object to create |

In the image, the value of the second element (“Element2” in the code below) is specified as a string rather than an array. Specify the values as shown in the code and the table in the steps below.
Implement by copying and pasting
Section titled “Implement by copying and pasting”As a sample, this article uses a flow that creates a custom object containing two elements: one whose content is a string, and one whose content is an array.
Copy the following code and paste it into the Power Automate Desktop flow designer to add the action.
Variables.ConvertJsonToCustomObject Json: $'''%'{ \'Element1\': \'Value1\', \'Element2\': [\'ArrayValue1\', \'ArrayValue2\'] }'%''' CustomObject=> JsonAsCustomObjectImplement in Power Automate Desktop
Section titled “Implement in Power Automate Desktop”-
In “Search actions”, type “Convert JSON to custom object”.
-
Set the parameters as follows.
Parameter Value JSON %‘{ 'Element1': 'Value1', 'Element2': ['ArrayValue1', 'ArrayValue2'] }’% Variables produced %JsonAsCustomObject% -
When you run the flow, the JSON data is stored in a variable as a custom object.
Possible exceptions
Section titled “Possible exceptions”If the specified JSON data is invalid, an error (“Error parsing the JSON”) occurs during parsing.
We recommend adding error handling with an “On block error” block.