How do I remove null or " " key:value pairs from an Airkit object?

Do we have any Airscript functions that we could use to remove null values from the objects.

Context: I have a customer’s app where the contents of a form is passed to an object, but further on users have the possibility to edit their personal info, including erasing optional data. If they delete a field that previously was completed it would leave this object with a null property.
This is part of a payload that is sent to an external platform where a data validation is performed which can’t accept null values.

Changing the external validation logic might be a possibility to but I’m trying to find a way to do this from our end.


Hey Adrian,

In situations like this, we’ve called a data flow in the journey to filter out null or "" values in key value pairs. To do this, I’d add a step in a data flow to remove any key:value pairs if the value is null or "". The Airscript would looks something like this:

  item != "" AND item != NULL
  "{{key}}": "{{item}}"

Or the following screenshot.

There might be other options, but I’ve used this before.