JsonSerializerOptions Class

Definition

Provides options to be used with JsonSerializer.

public ref class JsonSerializerOptions sealed
public sealed class JsonSerializerOptions
type JsonSerializerOptions = class
Public NotInheritable Class JsonSerializerOptions
Inheritance
JsonSerializerOptions

Remarks

For more information, see How to serialize and deserialize JSON.

Constructors

JsonSerializerOptions()

Initializes a new instance of the JsonSerializerOptions class.

Properties

AllowTrailingCommas

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.

Converters

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

DefaultBufferSize

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

DictionaryKeyPolicy

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

Encoder

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

IgnoreNullValues

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

IgnoreReadOnlyProperties

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

MaxDepth

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

PropertyNameCaseInsensitive

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

PropertyNamingPolicy

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.

ReadCommentHandling

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

WriteIndented

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

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetConverter(Type)

Returns the converter for the specified type.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to