hello,
i need only data value which is under attachment which is under tests for each test key
below json contains only 1 test key data.
check below json
{
“testExecutionKey”: “P003106-3677”,
“tests”: [
{
“status”: “PASS”,
“testKey”: “P003106-3262”,
“start”: “2022-09-01T11:10:17+02:00”,
“finish”: “2022-09-01T11:59:52+02:00”,
“executedBy”: “abc”,
“defects”: ,
“evidences”: [
{
“filename”: “TC 3262 TE 3677 Provision Managed Azure Sub_6.png”,
“contentType”: “image/png”,
“data”: “Provision Managed Azure Sub_6.png”
},
{
“filename”: “TC 3262 TE 3677 Provision Managed Azure Sub_6.png”,
“contentType”: “image/png”,
“data”: “Provision Managed Azure Sub_7.png”
}
],
“steps”: [
{
“status”: “PASS”,
“defects”: ,
“evidences”: [
{
“filename”: “TC 3262 TE 3677 Provision Managed Azure Sub_7.png”,
“contentType”: “image/png”,
“data”: “262 TE 3677 Provision Managed Azure Sub_7.png”
}
]
},
{
“status”: “PASS”,
“defects”: ,
“evidences”:
}
],
“assignee”: “jstefan”,
“testEnvironments”: ,
“iterations”: ,
“comment”: “null”
}
]
}
i want below values
1]Provision Managed Azure Sub_6.png - under evidence - data
2] Provision Managed Azure Sub_7.png - under evidence - data
vrdabberu
(Varunraj Dabberu)
January 29, 2024, 8:11am
2
Hi @Mathkar_kunal
→ Use Read Text file to read the json string and store the output say jsonString.
Input.txt (1.3 KB)
→ Use Deserialise Json activity and pass jsonString and store the output in a variable JObject.
→ Use below syntax in Assign activity:
Evidence1Data= JObject("tests")(0)("evidences")(0)("data").ToString
Evidence2Data= JObject("tests")(0)("evidences")(1)("data").ToString
Evidence1Data and Evidence2Data is of datatype System.String
→ Print the value in message box:
"Evidence 1 Data: " + Evidence1Data+vbCrLf+"Evidence 2 Data: " + Evidence2Data
Output:
xaml:
Sequence.xaml (8.2 KB)
Regards
vrdabberu
(Varunraj Dabberu)
January 29, 2024, 8:28am
4
Hi @Mathkar_kunal
Please check the workflow I have attached and I haven’t faced such an issue. If possible could you share th workflow.
Regards
Yoichi
(Yoichi)
January 29, 2024, 8:37am
5
Hi,
It may be better to use loop and list as result if number of the target may be dynamic.
Can you try the following?
Sample
Sample20240129-2.zip (3.5 KB)
Regards,
Hi @Mathkar_kunal
Use Assign Activity and use below expression in variable Array Of String names as ArrData
JsonObject.SelectTokens(“…tests[ * ].evidences[ * ].data”).Select(Function(d) d.ToString()).ToArray())
OUTPUT
Happy Automation
Cheers!!
system
(system)
Closed
February 1, 2024, 10:29am
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.