You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, the JSON serializer ignores data values it consider "empty". This is configurable with the SerializeProperties::ignore_empty_fileds flag. Unfortunately, I don't think I have documented this in the tutorial. I will do that.
Another option (that I use in cases where I need some numeric 0 values to be sent because the presence of the attribute is required on the receiving end) is to use std::optional<int> as the data-type and set the value to 0. In this case the serializer will see that the optional variable has a value, and it will serialize it.
Hi,
I'm trying to serialize a struct to json, I find that if one data's type is int and it has a value of 0, This data will not be displayed in json.
For example, i want serialize this struct to json with userId has a value of 0, id has a value of 1;
The json I get is
"userId" disappeared.
By the way, i also meet the same situation with this issues:
#114
thank you for you attation.
Regards,
The text was updated successfully, but these errors were encountered: