Json Serialize false value
Application Type
Traditional Web

Hi there! 

I have the following scenario, in a structure I have a Boolean property, which depending on a condition, it must be sent in json to a REST API, but in other cases not, below how this property is defined in the structure.

In cases where I do not need this property not to be serialized, this current configuration works, but in cases where I need to send this property with a false value, this configuration does not work, has anyone been through this and how did it resolve?

Obs: I can't leave it as mandatory

Rank: #172

Hi Janerson,

There are two properties that may help you to understand when an attribute is send or not.

The SendDefaultValue property, if defined as Yes, will send an attribute with the DefaultValue defined by you, even if it is not filled before.

Since you SendDefaultValue property is defined as No, it will only send the values if you fill it in an assign for example.

You can use the condition you mentioned in an if and assign this attribute incidenciaPrevidenciaria to True or False for example.

Hope it Helps,

RR :)

Are you assigning "false" to this attribute. If not then it will not send.

Just assign "false" when you want to send. Btw Raphael Ranieri provided detailed answer. :)