<PackageReference Include="System.Text.Json" Version="5.0.0-preview.2.20160.6" />

JsonSerializerOptions

public sealed class JsonSerializerOptions
Provides options to be used with JsonSerializer.
public bool AllowTrailingCommas { get; set; }

Get or sets a value that indicates whether an extra comma at the end of a list of JSON values in an object or array is allowed (and ignored) within the JSON payload being deserialized.

public IList<JsonConverter> Converters { get; }

Gets the list of user-defined converters that were registered.

public int DefaultBufferSize { get; set; }

Gets or sets the default buffer size, in bytes, to use when creating temporary buffers.

Gets or sets the policy used to convert a IDictionary key's name to another format, such as camel-casing.

public JavaScriptEncoder Encoder { get; set; }

Gets or sets the encoder to use when escaping strings, or null to use the default encoder.

public bool IgnoreNullValues { get; set; }

Gets or sets a value that determines whether null values are ignored during serialization and deserialization. The default value is false.

public bool IgnoreReadOnlyProperties { get; set; }

Gets a value that determines whether read-only properties are ignored during serialization. The default value is false.

public int MaxDepth { get; set; }

Gets or sets the maximum depth allowed when serializing or deserializing JSON, with the default value of 0 indicating a maximum depth of 64.

public bool PropertyNameCaseInsensitive { get; set; }

Gets or sets a value that determines whether a property's name uses a case-insensitive comparison during deserialization. The default value is false.

Gets or sets a value that specifies the policy used to convert a property's name on an object to another format, such as camel-casing, or null to leave property names unchanged.

Gets or sets a value that defines how comments are handled during deserialization.

public ReferenceHandling ReferenceHandling { get; set; }

public bool WriteIndented { get; set; }

Gets or sets a value that defines whether JSON should use pretty printing. By default, JSON is serialized without any extra white space.

Initializes a new instance of the JsonSerializerOptions class.

public JsonConverter GetConverter(Type typeToConvert)

Returns the converter for the specified type.