I’m trying to compose a request based on a response. I have the following pre-request script:
// Get the response.
var stageResponse = pm.variables.get("getResponse");
// Update some data.
entity = stageResponse.user.entities[0];
entity.value = "married";
// Setup the request.
var requestString = JSON.stringify(stageResponse);
// !!!console.log(requestString) logs the object in the correct json syntax.
pm.environment.set('requestBody', requestString);
And in the body, I have: {{requestBody}}
The problem is that the response has the following element:
{
"id": "123",
"description": "Why won't your spouse be a co-signer?",
}
But looking at the code after making the call, I see:
{
"id":"123",
"description":"Why won'\''t your spouse be a co-signer?"
}
which is not valid JSON. I cannot do any string manipulation since the pre-request value looks OK.
I’m running version 8.0.7
You can try a simple test using the following:
Thanks