DefaultContractreSolver .NET exclut les valeurs nuls JSonSerializersEttings contractresolver defaultContractreSolver
public class DataContractResolver : DefaultContractResolver
{
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
{
var property = base.CreateProperty(member, memberSerialization);
property.NullValueHandling = NullValueHandling.Include;
property.DefaultValueHandling = DefaultValueHandling.Include;
property.ShouldSerialize = o => true;
return property;
}
}
DreamCoder