How to update json with another value

Hello,

My reuirement is if assignee field is empty means if assignee is like below
“assignee”: ,
image

then need to fill value of executed by in assignee , here executed by value is abc
image

so my end json is with assignee as below
“assignee”: “abc”,

“testExecutionKey”: “P002645-151”,
“tests”: [
{
“status”:“PASS”,
“testKey”:“P002645-154”,
“start”:“2023-02-21T14:32:24+01:00”,
“finish”:“2023-02-22T09:12:52+01:00”,
“executedBy”:“abc”,
“defects”: ,
“evidences”: ,
“steps”: [
{
“status”: “PASS”,
“defects”: ,
“evidences”:
},
{
“status”: “PASS”,
“defects”: ,
“evidences”:
},
{
“status”: “PASS”,
“defects”: ,
“evidences”:
},
{
“status”: “PASS”,
“defects”: ,
“evidences”:
},
{
“status”: “PASS”,
“defects”: ,
“evidences”:
},
{
“status”: “PASS”,
“defects”: ,
“evidences”:
},
{
“status”: “PASS”,
“defects”: ,
“evidences”:
}
],
“assignee”: ,
“testEnvironments”: ,
“iterations”: ,
“comment”:“”
}

help me on same
here only 1 test key is present in real multiple test keys will be present in one json file under test execution key
image
@supermanPunch

Hi @Mathkar_kunal ,

Assuming your Json Data is like below, we can come to an implementation like below to update the executedBy values :
new 2.txt (1.8 KB)

Performing Deserialization and then Updating over a For Each loop, we could update the specific JObject Properties values :
image

Output Panel :
image

Here, All the executedBy property values present in all JObjects of tests are updated.

Let us know if you are not able to understand the implementation or if the data is not accurate, you could modify/model the data representation to your case and send it here, so that we can work/analyse on it further.

1 Like

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