Writing to JSON files, is there a way to automatically write 'null' if there is a blank entry?

Hi there,

I’ve made a bot which scrapes customer information from emails and inputs it into a JSON file to send off. I noticed whilst testing that if I send an email with the field name in there, but with no entry, that the JSON file still gets generated and sent off.

So for example, like this:
First Name: Joe
Last Name:
Age: 33
From: UK

So, I was wondering, is there a way that I can tell the bot to automatically write ‘null’ to the JSON file if the field is blank, like this?:

First Name: Joe
Last Name: null
Age: 33
From: UK

Thanks for your help.

give a try on following

filter over all properies with empty value and assign null or other default value

Hey Peter, thanks for this.

I’m sorry, I’m very new to this, could you explain exactly what/how to do that please?

share your exact json as valid json with us. Then we will pickup this for a prototype