I am migrating a web API from .NET Core 2.2 to 3.0 and want to use the new System.Text.Json
. When using Newtonsoft
I was able to format DateTime
using the code below. How can I accomplish the same?
.AddJsonOptions(options =>
{
options.SerializerSettings.DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc;
options.SerializerSettings.DateFormatString = "yyyy'-'MM'-'dd'T'HH':'mm':'ssZ";
});
Solved with a custom formatter. Thank you Panagiotis for the suggestion.