How to get value from json

Hello,

i have below json

{

“testExecutionKey”: “P000110-7887”,
“tests”: [
{
“status”: “TODO”,
“testKey”: “P000110-6436”,
“defects”: ,
“evidences”: [“kunal”],
“steps”: ,
“assignee”: “”,
“testEnvironments”: ,
“iterations”: ,
“comment”: “null”
}
]
}

how can i get testexecutionkey value P000110-7887 from this json
help me on same.

Hi @Mathkar_kunal

→ Use read text file activity to read the json file and store in a String Variable called InputJson.
→ Use the deseralize Json activity to deseralize the json data from the InputJson variables and store the output in a JsonObject datatype variable.
→ After that use the assign activity to extract the value and store in a String datatype variable.

1. Deserialize JSON
   - JsonString: Your JSON string
   - JsonObject: jsonObject

2. Assign
   - To: testExecutionKey
   - Value: jsonObject("testExecutionKey").ToString()

Check the below image for better understanding,

Hope it helps!!

1 Like

Hi @Mathkar_kunal
Download UiPath.WebAPI.Acitvities to get Deseialize JSON activity
Store that Json in a text file.
Input:
JSON.txt (322 Bytes)
→ Use Read Text File acitivity and store the output say JsonString
→ Use Deserialise Json and store the output like JObject
→ Use the below syntax in message box:

JObject("testExecutionKey").ToString

image

Regards

1 Like

Hi @Mathkar_kunal

Try this
image

jsonObject(“testExecutionKey”).ToString

Output will be P000110-7887

image

Hope it will helps you :slight_smile:
Cheers!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.