This activity helps in converting a JSON file, a JSON object or an input variable to a dataset.
To extract specific details from the dataset we can use other activities (Datatable activities).
This activity works within the scope.
Navigate to the bottom of this page to download the sample file for this activity.
Technical Reference
|
INPUT |
ExpirySecs: Specify the number of seconds for the table to be displayed. By default, the time is set to 10 seconds. We can change the expiry seconds to our requirement. |
MISC |
Display Name: Displays the name of the activity. You can also customize the activity name to help in troubleshooting. |
|
SkipOnError: It specifies whether to continue executing the workflow even if it throws an error. This supports only Boolean value “True or False.” True: Continues to execute the workflow irrespective of any error thrown. False: The workflow aborts if it throws any error. |
||
Version: Specifies the version of the Json feature in use. |
||
OUTPUT |
OutputDataset: The Json file is stored as a dataset in the variable declared here. |
|
Result: Returns the success state of the activity in boolean values. |
* Represents mandatory fields to execute the workflow
Use Case
The following activity illustrates how we can use input JSON file to convert it to a
dataset value.
Here we will be using a JSON file which has the user data with the name of the person,
age and the car the person owns, as an input.
Follow the below steps on how to build a workflow using a JSONToDataset activity.
Steps to execute the bot
1. Drag and drop a Json to Dataset activity within the GetJsonObject scope.
2. Fill in the required details for the Json to Dataset activity in the property box.
Specify the expiry seconds for the table display.
3. When we execute the activity the Json to dataset values is seen in a table as
below.
4. Declare a variable in the OutputDataset box of the output segment. Here it is
dsset.
5. To view the details of the Dataset in iteration, let’s assign the value as
dt = dsset.Tables(0) in the assign activity (To get the details from the first table we
have given the value as (0)).
6. Now drag and drop a writeline activity to the workflow, to see the output of a
value from the dataset. Here we need the value for cars from the datatable, so
we use dt.Rows(0)(“cars”).ToString(). It returns the first car value from the
datatable.
7. Execute the activity in debug mode to see the output of the Json file converted
to dataset values.
The bot executes the activity, extracts details from the Json file and displays the specific
detail from the datatable in the log.
Please find the attached Sample Json file for reference below in creating a workflow.