System.Text.Json – Use JsonConverterFactory to serialize multiple types the same way

Let’s say you want to serialize the four datetime types – DateTime, DateTime?, DateTimeOffset, and DateTimeOffset? – in the same way. You want to serialize them to use the US date style (ex: 7/14/2021). There are two main ways to accomplish this: Create a custom converter for each type. Create a custom converter factory + … Read more