Fonlow.DateOnlyExtensionsTextJson 1.2.0

dotnet add package Fonlow.DateOnlyExtensionsTextJson --version 1.2.0                
NuGet\Install-Package Fonlow.DateOnlyExtensionsTextJson -Version 1.2.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Fonlow.DateOnlyExtensionsTextJson" Version="1.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Fonlow.DateOnlyExtensionsTextJson --version 1.2.0                
#r "nuget: Fonlow.DateOnlyExtensionsTextJson, 1.2.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Fonlow.DateOnlyExtensionsTextJson as a Cake Addin
#addin nuget:?package=Fonlow.DateOnlyExtensionsTextJson&version=1.2.0

// Install Fonlow.DateOnlyExtensionsTextJson as a Cake Tool
#tool nuget:?package=Fonlow.DateOnlyExtensionsTextJson&version=1.2.0                

For 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:

  • Without the converters, naughty clients that provide null to struct will cause 500 error; with the converters, the client will get 400, a bit more graceful, being consistent with the good old Newtonsoft.Json.

Remarks:

  • .NET 7 clients and above may not need this in ASP.NET Core 7 and above. However, if you have JavaScript clients or other naughty clients that give null to struct, you may want some of the converters not obsolete.

Hints:

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 37 11/21/2024
1.1.0 170 6/7/2024

.NET 9