Use the DeserializeObject component
Convert a string containing JSON data to a JSON object by using the DeserializeObject component in RPA Desktop Design Studio. You can also extract specific properties from the JSON object.
Before you begin
Role required: none
About this task
To configure the properties for the DeserializeObject component, see Properties of the JSON utilities.
Procedure
In the Toolbox pane, navigate to Utilities > JSON.
Drag the DeserializeObject component to the Design surface.
To specify the required property name in the JSON object that you want to extract, do the following steps.
- Click the component settings icon (
Component settings icon.\).
2. Click the add property icon \(
Add properties icon.\).
3. Enter a property name.
4. Repeat the steps to add multiple properties.
A Data Out port is added with each key that you provide.
5. Click **OK**.
To configure the input field, see Configure port properties.
Connect the data and control ports of the DeserializeObject component to the corresponding ports of the other components as described in the following table.
| Port type | Port name | Data type | Description |
|---|---|---|---|
| Data In | JSON | String | The string containing JSON data to be converted to a JSON object. |
| Data Out | Object | Object | The output parameter to store the converted JSON object. |
| Data Out | Name of the port is the same as the name of the key that you add. | Object | Returns the value of the key from the string.This appears when additional properties are added to the component settings. |
- To test the component, right-click the component bar and then click Run From Here.
Convert a string to a JSON object
Convert string to object.
In this example, the ReadFromExcel component reads data from an Excel document and passes to the SerializeObject component. The SerializeObject component converts the data to string and passes to the DeserializeObject component. The DeserializeObject component converts the string to the JSON object. The items in the Excel document traverses from first to last in the For Each component and passes the item to the GetProperties component. The GetProperties component returns the name of the component and passes the name of the item to the Show component. The item is shown in a message box.
Parent Topic:JSON