I am trying to parse the json response from post request and send the parsed data to put request this is my response body
{
"createdBy": "student",
"createdOn": "2019-06-18",
"Id1": "0e8b9445-4bd9-4d31",
"Tl": [
{
"createdBy": "student",
"createdOn": "2019-06-18",
"Id2": "d46eeb88-f876-4468"
}
]
}
I am parsing id1
and id2
which are auto generated. This is the code I am writing in tests
var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable("Id1", jsonData.Id1);
postman.setEnvironmentVariable("Id2", jsonData.Tl[2].Id2);
id1
is working but I am unable to access Id2
and getting the error after post as
typeerror cannot read Id2 property
and I am accessing Id2 in put request as {{Id2}}