Read Data from JSON
Description
Use this activity to extract data from the input JSON content/file based on the provided JSONPath(s).
Design Time Configuration
This activity contains a design configuration similar to Multi Assign.
You can provide the JSON content as a literal string or through a variable of type string. To retrieve specific values from a JSON file: Create a list of corresponding JSONPath expressions. Define variables to hold these values and map them to their respective JSONPath expressions. In the first column, enter the variable name and add the corresponding JSONPath in the second column.
Properties
Input
- JSON Content – Specify the JSON content to extract the information.
Misc
- DisplayName - Add a display name to your activity.
- Private – If selected, the values of variables and arguments supplied will never be logged.
Optional
- Continue On Error – It Specifies whether the automation should continue even though this activity fails. This field only supports Boolean values (True, False). The default value is False.
If this activity is inside Try Catch and the value of this property is True, it will ignore errors during the automation execution.
Example
Retrieving Value from JSON Content
Retrieve a list of books from the following JSON file and select a specific book and its author, as shown in the screenshot below.
- To create JSON Content, you can use the Read JSON File activity and provide a JSON file as input.
- To read data from JSON, the JSON Content obtained in the previous step is set as the input to this activity
- Three string variables are added to retrieve a list of books, a particular book, and its author.
{
"library": {
"book": [
{
"title": "Introduction to Programming",
"author": "John Smith",
"year": 2020
},
{
"title": "Data Structures and Algorithms",
"author": "Alice Johnson",
"year": 2019
},
{
"title": "Web Development with HTML and CSS",
"author": "David Brown",
"year": 2021
}
]
}
}
Download Example