Relative Content

Tag Archive for c#.net-8.0system.text.json

how to enforce required properties when using a custom System.Text.Json.Serialization.JsonConverter

I am trying to write a custom converter by following the sample factory pattern converter at https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/converters-how-to?pivots=dotnet-8-0 and also trying to enforce required properties as described at https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/required-properties. I can find many examples of writing custom converters and many examples of defining required properties but I haven’t found any examples where both are used together.