Some business processes may consume the JSON as an input/output to exchange data to/from a web server.
When receiving data from a web server, the data is always a string.
Let’s explore how to extract the field from a JSON string!!!
Example
Implementation using UiPath :
Let us implement a workflow which consumes a JSON string and extracts the required fields.
Step 1:
Drag “Assign” activity into the designer panel and assign some JSON string as shown below.
“{
‘fruit’: ‘Apple’,
‘size’: ‘Large’,
‘color’: ‘Red’
}”
Step 2:
Drag “Deserialize JSON” activity into the designer panel to deserialize a JSON string. Supply the variable “json_Data” to it as input and create a variable called “out_Json” of JsonObject type.
Step 3:
Drag “Message Box” activity into the designer panel to display the “Fruit Name”.
Similarly, we can extract any number of required fields by passing the names of the appropriate tokens
Step 5:
Finally, let’s run the project to display the “Fruit Name”.
Hope this article finds you useful.
Happy Automation !!