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
ppr
(Peter Preuss)
January 24, 2024, 11:25am
2
We fixed the invalid JSON snippet to the following for the prototypings
We would deserialize JSON:
- out: myJObject
One of many options:
Can also be used for loops:
ppr
(Peter Preuss)
January 24, 2024, 11:32am
3
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
Happy Automation
Cheers!!
mkankatala
(Mahesh Kankatala)
January 24, 2024, 11:50am
5
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
ppr
(Peter Preuss)
January 25, 2024, 10:55am
7
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
hello,
please check 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”:
},
{
“status”: “PASS”,
“defects”: ,
“evidences”: [
{
“filename”: “TE4272_TC4264_1.png”,
“contentType”: “image/png”,
“data”: “TE4272_TC4264_1.png”
}
]
},
{
"s…
we suggest that you close this topic
Forum FAQ - How to mark a post as a solution - News / Tutorials - UiPath Community Forum
system
(system)
Closed
January 29, 2024, 7:53am
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.