Get Json Object

The "Get JsonObject" function acts as the overarching scope for all other activities within
this feature. It enables users to visually represent the input as "InputFile," "JsonObject,"
and "Variable" in a tree view format. This function facilitates the conversion of the input
into a dataset, its deserialization into an array format, and the extraction of individual
objects from the array of data.

The scope is where we provide the required JSON file, input string, or variable as an
input.

Please scroll down to the bottom of the page to access the sample file for this activity.

What can we give as a JSON Input?

The following inputs can be provided in the GetJson activity.

Upload file – This type can be used when a JSON file is already available in
your system or in the shared path. When we want to use the entire file for further
execution we can choose the uploadfile type.

InputString – This option can be used when we want to extract specific data from
the Json file or we can use a variable from a previous activity (Example: REST/SOAP
Json output), in which a Json file is stored.

Refer the “important” section to see how we can enter the input string directly.

Technical Reference

 


 

INPUT

JSONInput: Choose the JSONinput as upload file or input string.
InputString: It accepts a variable or a string value.
UploadFile: It accepts the file path of the Json file.

 

 

 

 

 

MISC

Body: Autofill’s when an activity is dropped inside the scope.

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: It specifies the version of the Json feature in use.

 

 

OUTPUT

IsValidJson: A Boolean value which specifies if the given value is a JSON or not.

Result: Returns the success state of the activity in Boolean value.

ResultData: It helps you to view the JSON output value in a string format.

Represents mandatory fields to execute the workflow.



Use Case

The following example illustrates how we can use the GetJsonObject activity and view
the details of the JsonObject.

Here the input will be a JSON file. It contains the name of a person, his age and the car
that the person owns.

The output of the given JSONObject can be seen in a string format. 

Steps to execute the bot

1.      Drag and drop a Get Json object to the workflow.

2.      Double click on the activity and choose upload Json file from the file type.

3.      Click on the three dots and choose the Json file.

4.      Declare a variable in the result data box of the output segment. Here it is "RD".

5.      Drag and drop a writelog activity to the workflow.

6.      Enter the declared variable as the input string.

7.      Enter the log level as “info”.

8.      Execute the workflow to see the details in the Json file.

The bot executes the activity, gets the details from the Json file, and displays the details
of the file in the log.

Please find the attached Sample Json file for reference below in creating a workflow.

File
Jsonsample(1)_1.txt (153 bytes)