neuecc / Utf8Json

Definitely Fastest and Zero Allocation JSON Serializer for C#(NET, .NET Core, Unity, Xamarin).
MIT License
2.36k stars 267 forks source link

Exclude default values from serialization #153

Open tadam75 opened 5 years ago

tadam75 commented 5 years ago

Hello,

In order to spare bandwidth and to have the same behaviour as Json.NET DefaultValueHandling.Ignore attribute, it would be great to have the possibility to remove default values from serialization.

I've worked on it for the types I'm using (bool, int, double, decimal, enum) in this commit, but I think a general solution would be a nice feature for your library.

andreminelli commented 3 years ago

It's a very handy feature, indeed. Or, alternatively, can you guys provide a method to entirely exclude a property on JsonWriter