Class JsonSerializerOptions
Represents a set of behavior options for the JsonSerializer object.
Inheritance
Inherited Members
Namespace: Manatee.Json.Serialization
Assembly: Manatee.Json.dll
Syntax
public class JsonSerializerOptions
Constructors
| Improve this Doc View SourceJsonSerializerOptions()
Creates a new instance of JsonSerializerOptions with default options.
Declaration
public JsonSerializerOptions()
JsonSerializerOptions(JsonSerializerOptions)
Creates a new instance of JsonSerializerOptions by copying an existing JsonSerializerOptions instance.
Declaration
public JsonSerializerOptions(JsonSerializerOptions options)
Parameters
Type | Name | Description |
---|---|---|
JsonSerializerOptions | options | The JsonSerializerOptions instance to copy. |
Fields
| Improve this Doc View SourceDefault
Default options used by the serializer.
Declaration
public static readonly JsonSerializerOptions Default
Field Value
Type | Description |
---|---|
JsonSerializerOptions |
Properties
| Improve this Doc View SourceAutoSerializeFields
Gets and sets whether public fields should be serialized during autoserialization.
Declaration
public bool AutoSerializeFields { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
CaseSensitiveDeserialization
Gets and sets whether the serializer considers case for properties while deserializing.
Declaration
public bool CaseSensitiveDeserialization { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
This only affects automatic serialization.
CustomDateTimeSerializationFormat
Gets and sets a custom serialization format for System.DateTime.
Declaration
public string? CustomDateTimeSerializationFormat { get; set; }
Property Value
Type | Description |
---|---|
System.Nullable<System.String> |
DateTimeSerializationFormat
Gets and sets the format for System.DateTime serialization using the default serializer methods.
Declaration
public DateTimeSerializationFormat DateTimeSerializationFormat { get; set; }
Property Value
Type | Description |
---|---|
DateTimeSerializationFormat |
Remarks
If a custom serializer for DateTime has been registered, this property will have no effect.
DeserializationNameTransform
Gets and sets a transformation function for property names during deserialization. Default is no transformation.
Declaration
public Func<string, string> DeserializationNameTransform { get; set; }
Property Value
Type | Description |
---|---|
System.Func<System.String, System.String> |
EncodeDefaultValues
Gets and sets whether the serializer encodes default values for properties.
Declaration
public bool EncodeDefaultValues { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Setting to 'true' may significantly increase the size of the JSON structure.
EnumSerializationFormat
Gets and sets the format for enumeration serialization using the default serializer methods.
Declaration
public EnumSerializationFormat EnumSerializationFormat { get; set; }
Property Value
Type | Description |
---|---|
EnumSerializationFormat |
FlagsEnumSeparator
Gets and sets a separator to be used when serializing enumerations marked with the System.FlagsAttribute.
Declaration
public string FlagsEnumSeparator { get; set; }
Property Value
Type | Description |
---|---|
System.String |
InvalidPropertyKeyBehavior
Gets and sets the behavior of the deserializer when a JSON structure is passed which contains invalid property keys.
Declaration
public InvalidPropertyKeyBehavior InvalidPropertyKeyBehavior { get; set; }
Property Value
Type | Description |
---|---|
InvalidPropertyKeyBehavior |
OnlyExplicitProperties
Gets and sets whether the serializer will serialize only the properties defined by the type given as the generic parameter.
Declaration
public bool OnlyExplicitProperties { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
PropertySelectionStrategy
Gets and sets which properties are automatically included while serializing.
Declaration
public PropertySelectionStrategy PropertySelectionStrategy { get; set; }
Property Value
Type | Description |
---|---|
PropertySelectionStrategy |
Resolver
Gets and sets an IResolver implementation for instantiating objects while deserializing.
Declaration
public IResolver Resolver { get; set; }
Property Value
Type | Description |
---|---|
IResolver |
SerializationNameTransform
Gets and sets a transformation function for property names during serialization. Default is no transformation.
Declaration
public Func<string, string> SerializationNameTransform { get; set; }
Property Value
Type | Description |
---|---|
System.Func<System.String, System.String> |
TypeNameSerializationBehavior
Gets and sets whether the serializer always includes the type name while serializing.
Declaration
public TypeNameSerializationBehavior TypeNameSerializationBehavior { get; set; }
Property Value
Type | Description |
---|---|
TypeNameSerializationBehavior |
Remarks
This only affects automatic serialization.