JSON Deserialization

This action is used to convert a string to a JSON Object.

Properties

Input

  • Content: the name of the variable which stores the string content.

  • Output: the name of the variable used to store the result.

the output must be a JObject type.

Misc

  • Display Name: action display name in your implementation project.

  • Wait Before: number milliseconds robot to wait before executing the action.

  • Wait After: number milliseconds robot to wait until moving to the next action.

  • Abort on Error: True/False

  • Retry Times: Specifies the number of times to retry an action if it doesn't end successfully. Default value 0 (no retry); Use -1 if you want to retry indefinitely.

Use Case

Potential Use Cases

  • Deserialize information captured via HTTP Rest Request, in order to use it in the workflow.

Examples of Using JSON Deserialization

Example 1

In this example, the robot will access the API of coindesk.com and retrieve the price of bitcoin in EUR.

Steps:

  • Create a new project

  • Create a new Sequence and rename it.

  • Create 2 variables: a string and a JSONobject

  • Add a new activity HTTP Rest Request in the newly created Sequence and edit the following parameters:

    • URL: "https://api.coindesk.com/v1/bpi/currentprice.json"

    • Method: GET

    • Output: a string variable (outputREST)

    • Response Code: an int32 variable (responseCode)

  • Add a new activity JSON Deserialization in the same Sequence and edit the following parameters:

    • Content: the same string variable (outputREST)

    • Output: a JObject variable (rate)

"Today, "+DateTime.Now + ", 1 bitcoin = " + rate["bpi"]["EUR"]["rate"] + " EUR"

where rate["bpi"]["EUR"]["rate"] is the JSON hierarchy (please see the screenshot below from JSON formatter)

This is how your sequence should look like.

Watch the robot in action:

You can see how the JSON Deserialization activity is used in an example that incorporates multiple activities. You can check and download the example from here:

The article doesn't fully answer your question, or you want to find out more? Ask your question in the comments, on our community forum, or contact our support team or your account manager. Whatever works for you, your question will find its answer soon!

Last updated