C#C
C#8mo ago
Core

✅ JSON - can't deserialize nullable property if it it's not present

Hello,
Is if a nullable property is not present in the JSON the deserialization will fail. Is there a way to make deserialization work if a property is not present?

c#
return new JsonSerializerOptions
{
    PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
    DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
};

JSON deserialization for type 'UaDetector.Regexes.Models.Bot' was missing required properties including: 'producer'
Was this page helpful?