JsonExtensions.AddNumericsJson Method

Registers Numerics.NET JSON converters and metadata on the given options instance.

Definition

Namespace: Numerics.NET.Data.Json
Assembly: Numerics.NET.Data.Json (in Numerics.NET.Data.Json.dll) Version: 4.1.0
C#
public static JsonSerializerOptions AddNumericsJson(
	this JsonSerializerOptions options
)

Parameters

options  JsonSerializerOptions
The JsonSerializerOptions to configure.

Return Value

JsonSerializerOptions

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type JsonSerializerOptions. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

All custom converters use the user-supplied options for all nested serialization and deserialization.

For .NET 6+ and source-generated contexts, you can combine your own context with Numerics.NET's using JsonTypeInfoResolver.Combine:

C#
options.TypeInfoResolver = JsonTypeInfoResolver.Combine(NumericsJsonContext.Default, MyAppJsonContext.Default);

This ensures both your types and Numerics.NET types are supported for AOT and high performance.

See Also