UiPath Activities

The UiPath Activities Guide

Deserialize Json

UiPath.Web.Activities.DeserializeJson

Deserializes the JSON string to a JObject.

Properties

Common

  • DisplayName - The display name of the activity.

Input

  • JsonString - The string containing the JSON to be deserialized. The JSON should be written without indents, and between double quotes. Strings inside the JSON should be written with single quotes. For example, the following JSON is valid: "{'TenancyName': 'Documentation', 'UsernameOrEmail': 'Documentation', 'Password': 'Documentation'}".

Misc

  • Private - If selected, the values of variables and arguments are no longer logged at Verbose level.

Output

  • JsonObject - The deserialized JSON, as a Newtonsoft.Json.Linq.JObject variable.

Example of Using the Deserialize Json Activity

The Deserialize Json activity is used for extracting data from .json files and strings.
To exemplify how to use this activity, we have created an example that uses the Deserialize Json activity for extracting the age of a person from a .json file.

This is how the automation process can be built:

  1. Open Studio and create a new Process.
  2. Drag a Sequence to the Workflow Designer.
    • Create the following variables:
Variable Name
Variable Type
Default Value

JsonText

String

-

JsonObj

JObject

-

Age

GenericValue

-

  1. Drag a Read Text File activity inside the sequence container.
    • In the Properties panel, add the value "JsonString.txt" in the FileName field.
    • Add the variable JsonText in the Content field.
  2. Add a Deserialize JSON activity below the Read Text File activity.
    • In the Properties panel, add the variable JsonText in the JsonString field and the variable JsonObj in the JsonObject field.
    • Select the value Newtonsoft.Json.Linq.JObject from the TypeArgument drop-down list.
  3. Place an Assign activity under the Deserialize JSON activity.
    • Add the variable Age in the To field and the expression JsonObj.SelectToken("age").ToString in the Value field.
  4. Drag a Write Line activity below the Assign activity.
    • Add the variable Age in the Text field.
  5. Run the process. The robot extracts the age value from the .json file and displays it in the Output panel.

Updated 2 months ago


Deserialize Json


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.