I have created this data by using Post and I have stored total response in one variable.
Now I want to update the title value as “welcome” ,using put.
{
“mid”:“574800”,
“pay”:"{\“id\”:\“d4683215-b2c1-4c0d-bd8b-e7e42f28a3a\”,\“templateId\”:\“d9297e66-29cb-4425-8555-332a71a5a30a\”,\“title\”:\“welcome}”,
“svc”:“task”
}
Test script:
var response=JSON.parse(responseBody);
pm.globals.set(“variable”,JSON.stringify(response);
Pre-request script:
var request=JSON.parse(pm.globals.get("variable));
request.pay.title=“welcome”;
console.log(request);
pm.globals.set(“req_body”,JSON.stringify(request));
In body:
{{req_body}}
I have tried in this way but the value was not updating. Can you please help me on this.
And in console window “request” variable the data was storing in this format after using the parse.
{
“mid”:“574800”,
“pay”:"{“id”:“d4683215-b2c1-4c0d-bd8b-e7e42f28a3a”,“templateId”:“d9297e66-29cb-4425-8555-332a71a5a30a”,“title”:“welcome}”,
“svc”:“task”
}