How can I get null booleans into an outgoing payload?

I'm (unfortunately) somewhat experienced with outsystems's painful lack of null support but I can't figure out what the workaround for booleans needs to be.

I'm trying to create a JSON string to feed into an extension and send to an external service.

Say my payload has two fields; If I want to not send either of these, I can select the 'Don't serialise null values" option on the OS deserializer. If I want to set both to false, that's great, I can set them both to false

The problem: If I want to set one to False and one to Null, I can't. 

If I have a payload where both False and Null are both valid values that can appear in different fields at the same time, how can I differentiate between the fields?

Hi,

You could use a string instead of boolean and set it to "False", "True" or "" where the empty string represents your null value.

Alternatively you need for every Boolean an extra Boolean like <attribute>IsSpecified which you set to false if the attribute value false means null. Else you set it to true meaning that the attribute value false means false.

Regards,

Daniel

Alright, thanks Daniel. I had considered both those options and was hoping there was some other solution that I hadn't thought of which was a little less... well, awful, but I guess this is the reality of working in Outsystems.

From my thinking so far, each of these 'solutions' brings a whole pile of other issues with them.

I'll have to keep digging with the team and see what we can do to make this work