JsonSerializerOptions Constructors

Definition

Overloads

JsonSerializerOptions()

Initializes a new instance of the JsonSerializerOptions class.

JsonSerializerOptions(JsonSerializerDefaults)

Constructs a new JsonSerializerOptions instance with a predefined set of options determined by the specified JsonSerializerDefaults.

JsonSerializerOptions(JsonSerializerOptions)

Copies the options from a JsonSerializerOptions instance to a new instance.

JsonSerializerOptions()

Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs

Initializes a new instance of the JsonSerializerOptions class.

C#
public JsonSerializerOptions();

Applies to

.NET 10 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)

JsonSerializerOptions(JsonSerializerDefaults)

Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs

Constructs a new JsonSerializerOptions instance with a predefined set of options determined by the specified JsonSerializerDefaults.

C#
public JsonSerializerOptions(System.Text.Json.JsonSerializerDefaults defaults);

Parameters

defaults
JsonSerializerDefaults

The JsonSerializerDefaults to reason about.

Applies to

.NET 10 and other versions
Product Versions
.NET 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)

JsonSerializerOptions(JsonSerializerOptions)

Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs
Source:
JsonSerializerOptions.cs

Copies the options from a JsonSerializerOptions instance to a new instance.

C#
public JsonSerializerOptions(System.Text.Json.JsonSerializerOptions options);

Parameters

options
JsonSerializerOptions

The options instance to copy options from.

Exceptions

options is null.

Applies to

.NET 10 and other versions
Product Versions
.NET 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)