Null Variables in Body of a Put

I am trying to use a variable that has a null value in the body of a PUT. The null gets converted to “” after the post. Is there a way to have variable actually set the field null instead of an empty string?

pm.collectionVariables.set("Address1", "21 Lake Dr.");
pm.collectionVariables.set("Address2", null);
pm.collectionVariables.set("City", "Saint Louis");
pm.collectionVariables.set("State", "MO");
pm.collectionVariables.set("ZipCode", "63123");

PUT .../api/address/{id}

   "id": "1",
   "Address1": "{{Address1}}",
   "Address2": "{{Address2}}",
   "City": "{{City}}",
   "State": "{{State}}",
   "ZipCode": "{{ZipCode}}"

Hey @ewstoces,

Welcome to the community! :wave:

You could do something like this to add the null value.

Add the dynamic variable to the request body without quotes:

	"Address2": {{Address2}}

In your Pre-request Script, add the null value with quotes:

pm.collectionVariables.set("Address2", "null");

This is would it look like in the response body, I’m just using the postman-echo service to replicate the request: