Postman: Can i save JSON objects to environment variable so as to chain it for another request?

I tried using the postman.setEnvironmentVariable() method in which I can set simple numbers and string values. My question is when I tried saving an object, it saves as [object Object]. I want to know if it is possible to save a JSON object so I can use it in another Request.


Solution 1:

You should use JSON.stringify() before setting it to environment variable.

Then after you call it in next request, use JSON.parse() to recreate the object.

Hope it helps.