Using System.Text.Json JsonSerializer to deserialize from api and serialize to file with different names
I’m using C#, .NET 8 and System.Text.Json
JsonSerializer
.
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.
In System.Text.Json is it possible to minify only array items?
Using System.Text.Json, is it possible to serialise an array such that each array item appears on a new line but each line is minified? Here is my console app attempting to use Utf8JsonWriter
to write each array item.