JsonSerializerOptions Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
For more information, see How to serialize and deserialize JSON.
Json |
Initializes a new instance of the JsonSerializerOptions class. |
Json |
Constructs a new JsonSerializerOptions instance with a predefined set of options determined by the specified JsonSerializerDefaults. |
Json |
Copies the options from a JsonSerializerOptions instance to a new instance. |
Allow |
Allows JSON metadata properties to be specified after regular properties in a deserialized JSON object. |
Allow |
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. |
Default |
Gets a read-only, singleton instance of JsonSerializerOptions that uses the default configuration. |
Default |
Gets or sets the default buffer size, in bytes, to use when creating temporary buffers. |
Default |
Gets or sets a value that determines when properties with default values are ignored during serialization or deserialization. The default value is Never. |
Dictionary |
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 |
Ignore |
Obsolete.
Gets or sets a value that indicates whether |
Ignore |
Gets or sets a value that indicates whether read-only fields are ignored during serialization. A field is read-only if it is marked with the |
Ignore |
Gets or sets a value that indicates whether read-only properties are ignored during serialization. The default value is |
Include |
Gets or sets a value that indicates whether fields are handled during serialization and deserialization.
The default value is |
Indent |
Defines the indentation character being used when WriteIndented is enabled. Defaults to the space character. |
Indent |
Defines the indentation size being used when WriteIndented is enabled. Defaults to two. |
Is |
Gets a value that indicates whether the current instance has been locked for user modification. |
Max |
Gets or sets the maximum depth allowed when serializing or deserializing JSON, with the default value of 0 indicating a maximum depth of 64. |
New |
Gets or sets the new line string to use when WriteIndented is The default is the value of NewLine. |
Number |
Gets or sets an object that specifies how number types should be handled when serializing or deserializing. |
Preferred |
Gets or sets the preferred object creation handling for properties when deserializing JSON. |
Property |
Gets or sets a value that indicates whether a property's name uses a case-insensitive comparison during deserialization. The default value is |
Property |
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 |
Read |
Gets or sets a value that defines how comments are handled during deserialization. |
Reference |
Gets or sets an object that specifies how object references are handled when reading and writing JSON. |
Respect |
Gets or sets a value that indicates whether nullability annotations should be respected during serialization and deserialization. |
Respect |
Gets or sets a value that indicates whether non-optional constructor parameters should be specified during deserialization. |
Type |
Gets or sets the JsonTypeInfo contract resolver used by this instance. |
Type |
Gets the list of chained JsonTypeInfo contract resolvers used by this instance. |
Unknown |
Gets or sets an object that specifies how deserializing a type declared as an Object is handled during deserialization. |
Unmapped |
Gets or sets an object that specifies how JsonSerializer handles JSON properties that cannot be mapped to a specific .NET member when deserializing object types. |
Web |
Gets a read-only, singleton instance of JsonSerializerOptions that uses the web configuration. |
Write |
Gets or sets a value that indicates whether JSON should use pretty printing. By default, JSON is serialized without any extra white space. |
Add |
Obsolete.
Appends a new JsonSerializerContext to the metadata resolution of the current JsonSerializerOptions instance. |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
Get |
Returns the converter for the specified type. |
Get |
Serves as the default hash function. (Inherited from Object) |
Get |
Gets the Type of the current instance. (Inherited from Object) |
Get |
Gets the JsonTypeInfo contract metadata resolved by the current JsonSerializerOptions instance. |
Make |
Marks the current instance as read-only to prevent any further user modification. |
Make |
Marks the current instance as read-only preventing any further user modification. |
Memberwise |
Creates a shallow copy of the current Object. (Inherited from Object) |
To |
Returns a string that represents the current object. (Inherited from Object) |
Try |
Tries to get the JsonTypeInfo contract metadata resolved by the current JsonSerializerOptions instance. |
Get |
Generates a JSON schema corresponding to the contract metadata of the specified type. |
Product | Versions |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback: