NodaTime .NET Core 2 json serialization configuration

NodaTime is a good replacement library for the .net DateTime.

add the nuget pacakge NodaTime.Serialization.JsonNet

To configure NodaTime for json seralization in .net core add the following to your serviceCollection:

  public void ConfigureServices(IServiceCollection aServiceCollection)
        .AddJsonFormatters(jsonSerializerSettings => jsonSerializerSettings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb))

Visual Studio 2017
.net Core 2 NodaTime 2.2.3
NodaTime.Serialization.JsonNet 2.0.0

Steven T. Cramer

Read more posts by this author.

Ada, Ohio