How to set the entire body of a PUT request with the stored JSON object of a previous GET request?

Hello everyone.
When I do a GET request on an endpoint, I have some code in my “Tests” tab that does the following:
var response = pm.response.json();
response.terms = “accept”; = new Date().getDate();
var jsonBody = JSON.stringify(response);
pm.environment.set(“nextPutVar”, jsonBody);

This successfully captures the entire received JSON payload and stores it as an environment variable. My Postman runner then goes to a PUT request, where I want to insert the entire JSON object from the previous GET into the body of the PUT. Any ideas on how I could do this?

Hi @n1502491, am wondering if the solution in this Stack Overflow question might help?

There are a few similar questions on there so it may be worth having a look. :slightly_smiling_face:

This also looks like the relevant documentation section: