Description
Using the deserialize JSON Activity allows the user to easily extract the desired data from a JSON string by in example deserializing the JSON string to a JObject.
Properties
Analyst
- Display Name: Optional friendly name used for debugging, validation, exception handling, and activity tracking.
- Description: Optional text for documentation purposes.
Common
-
Disable Log: Disables the logging functionality for this activity.
-
Disable Protocol: Disables the protocol functionality for this 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:
"{ 'Email': 'james@example.com', 'Active': true, 'CreatedDate': '2013-01-20T00:00:00Z', 'Roles': [ 'User', 'Admin' ] }"
Output
- Json Token: The output parameter of the activity contains a JToken for which the user can decide by a "Select Type" Popup about the specific class of the output. Depending on the string input format, different output types might fit best.
Possible output types are classes provided by the Newtonsoft.Json.Linq namespace:
JArray |
Represents a JSON array. |
---|---|
JConstructor |
Represents a JSON constructor. |
JContainer |
Represents a token that can contain other tokens. |
JObject |
Represents a JSON object. |
JProperty |
Represents a JSON property. |
JRaw |
Represents a raw JSON string. |
JToken |
Represents an abstract JSON token. |
JValue |
Represents a value in JSON (string, integer, date, etc). |
Example
Extract email address from a JSON string by deserializing it to a JObject
- Drag-in Deserialize JSON.
- Select JObject as the output type.
- Create a JObject and a string variable using the variable pop-up provided by Hyland RPA Designer.
- Set the default value of the json string to the example string above.
- Drag-in a Write Log Activity and set the Output text to "JObject.GetValue("Email").ToString".
- Run the process. The result "james@example.com" is shown in the output log.