Add Json stored in a variable to a request body

Hi all!

I been trying to find a way to store a json in a variable in a GET request, store it in a collection variable and use it in a POST request in a collection run.
So far, I been able to store it with no issues in the GET request, but having issues to post it correctly.

I tried using:
“{{MyJsonVar}}”, [{{MyJsonVar}}], ["{{MyJsonVar}}"], {{MyJsonVar}} and still no luck. Is there anything I’m missing? Any help would be greatly appreciated!


Hey @NRS, could you share more details on the exact structure of your requests and json value? Feel free to redact sensitive information :smile:

Yes of course! So the structure goes like this:

The GET request have this in the tests:

    // parse Json response object
    let result = JSON.parse(responseBody);
    let existingJobId =;
    let customFields =;
    console.log('Original Job bag custom fields: ' + customFields);
    let stringifiedCustomFields = JSON.stringify(customFields);
    console.log('stringified custom fields: ' + stringifiedCustomFields);
    // make sure we clean up any previous values.
    tests["Job Bag Exists"] = existingJobId !== null;
    tests["Has custom fields"] = customFields !== null;
    pm.variables.set("job_id", existingJobId);
    pm.variables.set("properties", stringifiedCustomFields);

        console.log('Error parsing JSON: ' + e);

Then in the POST body, I have this:

	"CopyFromId": {{job_id}},
	"Name": "{{next_job_name}}",
	"CompletionDate": "02/02/2011",
	"Properties": "{{properties}}"

properties is a variable in the collection and is the JSON i need to send in the duplicate request.
Sadly, is sending that as null.


@kunagpal I must say I’m a bit surprised what I see.
Have you marked @NRS 's description of a problem as a solution to the problem? :smiley: