How to split json

hello,
i need to fetch only data values from below json

{

“testExecutionKey”: “P003106-4272”,
“tests”: [
{
“status”: “PASS”,
“testKey”: “P003106-4264”,
“start”: “2022-11-02T08:54:16+01:00”,
“finish”: “2022-11-03T10:08:09+01:00”,
“executedBy”: “abc”,
“defects”: ,
“evidences”: ,
“steps”: [
{
“status”: “PASS”,
“defects”: ,
“evidences”: [
{
“filename”: “TE4272_TC4264_5.png”,
“contentType”: “image/png”,
“data”: “firstattchment/TE4272_TC4264_5.png”
},
{
“filename”: “TE4272_TC4264_6.png”,
“contentType”: “image/png”,
“data”: “secondattachment/TE4272_TC4264_6.png”
},
{
“filename”: “TE4272_TC4264_7.png”,
“contentType”: “image/png”,
“data”: “thirdattachment/TE4272_TC4264_7.png”
}
]
}
}
]
}

i need only values present in data whicgh are 1 st data value
1] firstattchment/TE4272_TC4264_5.png 2 nd data value 2]secondattachment/TE4272_TC4264_6.png and 3 rd data value
3]thirdattachment/TE4272_TC4264_7.png

let me know how can i achieve that

We fixed the invalid JSON snippet to the following for the prototypings

We would deserialize JSON:
grafik - out: myJObject

One of many options:
grafik

Can also be used for loops:
grafik

running it with your second test data (also JSON fix was needed)

Hi @Mathkar_kunal

Use Assign Activity and use below expression in variable Array Of String names as ArrData

jsonObject.SelectToken(“tests[0].steps[0].evidences”).Select(Function(evidence) evidence.SelectToken(“data”).ToString()).ToArray()


OUTPUT
image

Happy Automation :slight_smile:
Cheers!!

Hi @Mathkar_kunal

Store that Json in a text file.
Input:
JSON.txt (1006 Bytes)
→ Use Read Text File acitivity and store the output say JsonString
→ Use Deserialise Json and store the output like JObject
You can use the below syntax in Message Box:

String.Join(vbCrLf,JObject.SelectTokens("..data"))

Hope it helps!!
Regards

why you are writing … data please update

Select Token is using JSON Path
JSONPath - XPath for JSON

here we look from a particular starting point to all descendant data properties

As you continued with a new topic

we suggest that you close this topic
Forum FAQ - How to mark a post as a solution - News / Tutorials - UiPath Community Forum

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