How to setup JsonSerializer
to ignore DateTime properties with default value 0001-01-01T00:00:00
, but to serialize enums and numbers with default values at the same time?
this ignores also enums:
_jsonSerializer = new JsonSerializer();
_jsonSerializer.DefaultValueHandling = DefaultValueHandling.Ignore;
and this includes also default datetimes:
_jsonSerializer.DefaultValueHandling = DefaultValueHandling.Include;