My apologies for the silly question, but I don't see a good example of how can I specify a specific format for DateTime in JSON serialization for .net core 6.
The old way, net core 3.
// in the ConfigureServices()
services.AddControllers()
.AddJsonOptions(options =>
{
options.JsonSerializerOptions.Converters.Add(new DateTimeConverter());
});
There is an example on the official website https://learn.microsoft.com/en-us/dotnet/standard/datetime/system-text-json-support
JsonSerializerOptions options = new JsonSerializerOptions();
options.Converters.Add(new DateTimeConverterForCustomStandardFormatR());
"
But how can I wire it up to DI so It is used in the Controller?