Handle DateOnly in ASP.NET 6
$ dotnet add package Fonlow.DateOnlyExtensionsTextJsonFor ASP.NET Core 6
For ASP.NET Core 7 and above, needed by .NET Framework clients, JavaScript clients and any naughty client, since System.Text.Json is a bit less fault tolerant than Newtonsoft.Json
Customized serialization for DateOnly in ASP.NET Core 6 and above.
Similar to Fonlow.DateOnlyExtensions but without using NewtonSoft.Json, suitable for ASP.NET Core Web API using System.Text.Json only.
Usage:
.AddJsonOptions(
options =>
{
//Needed by .NET Framework clients, JavaScript clients and any naughty client, since System.Text.Json is a bit less fault tolerant thant Newtonsoft.Json
options.JsonSerializerOptions.Converters.Add(new Fonlow.Text.Json.DateOnlyExtensions.DateOnlyJsonConverter());
options.JsonSerializerOptions.Converters.Add(new Fonlow.Text.Json.DateOnlyExtensions.DateTimeJsonConverter());
options.JsonSerializerOptions.Converters.Add(new Fonlow.Text.Json.DateOnlyExtensions.DateTimeOffsetJsonConverter());
Hints:
Remarks:
Hints: