System.Text.Json.Serialization Namespace

Contains classes that are used to customize and extend serialization and deserialization of objects into JSON formatted documents or streams, either via an attribute model or via type converters.

Classes

JsonAttribute

Provides the base class for serialization attributes.

JsonConstructorAttribute

When placed on a constructor, indicates that the constructor should be used to create instances of the type on deserialization.

JsonConverter

Converts an object or value to or from JSON.

JsonConverter<T>

Converts an object or value to or from JSON.

JsonConverterAttribute

When placed on a property or type, specifies the converter type to use.

JsonConverterFactory

Supports converting several types by using a factory pattern.

JsonDerivedTypeAttribute

When placed on a type declaration, indicates that the specified subtype should be opted into polymorphic serialization.

JsonExtensionDataAttribute

When placed on a property of type IDictionary<TKey,TValue>, any properties that do not have a matching member are added to that dictionary during deserialization and written during serialization.

JsonIgnoreAttribute

Prevents a property from being serialized or deserialized.

JsonIncludeAttribute

Indicates that the member should be included for serialization and deserialization.

JsonNumberHandlingAttribute

When placed on a type, property, or field, indicates what JsonNumberHandling settings should be used when serializing or deserializing numbers.

JsonPolymorphicAttribute

When placed on a type, indicates that the type should be serialized polymorphically.

JsonPropertyNameAttribute

Specifies the property name that is present in the JSON when serializing and deserializing. This overrides any naming policy specified by JsonNamingPolicy.

JsonPropertyOrderAttribute

Specifies the property order that is present in the JSON when serializing. Lower values are serialized first. If the attribute is not specified, the default value is 0.

JsonRequiredAttribute

Indicates that the annotated member must bind to a JSON property on deserialization.

JsonSerializableAttribute

Instructs the System.Text.Json source generator to generate source code to help optimize performance when serializing and deserializing instances of the specified type and types in its object graph.

JsonSerializerContext

Provides metadata about a set of types that is relevant to JSON serialization.

JsonSourceGenerationOptionsAttribute

Instructs the System.Text.Json source generator to assume the specified options will be used at run time via JsonSerializerOptions.

JsonStringEnumConverter

Converts enumeration values to and from strings.

ReferenceHandler

Defines how the JsonSerializer deals with references on serialization and deserialization.

ReferenceHandler<T>

Defines how the JsonSerializer deals with references on serialization and deserialization.

ReferenceResolver

Defines how the JsonSerializer deals with references on serialization and deserialization. Defines the core behavior of preserving references on serialization and deserialization.

Interfaces

IJsonOnDeserialized

Specifies that the JSON type should have its OnDeserialized() method called after deserialization occurs.

IJsonOnDeserializing

Specifies that the type should have its OnDeserializing() method called before deserialization occurs.

IJsonOnSerialized

Specifies that the type should have its OnSerialized() method called after serialization occurs.

IJsonOnSerializing

Specifies that the type should have its OnSerializing() method called before serialization occurs.

Enums

JsonIgnoreCondition

Controls how the JsonIgnoreAttribute ignores properties on serialization and deserialization.

JsonKnownNamingPolicy

The JsonNamingPolicy to be used at run time.

JsonNumberHandling

Determines how JsonSerializer handles numbers when serializing and deserializing.

JsonSourceGenerationMode

The generation mode for the System.Text.Json source generator.

JsonUnknownDerivedTypeHandling

Defines how objects of a derived runtime type that has not been explicitly declared for polymorphic serialization should be handled.

JsonUnknownTypeHandling

Defines how deserializing a type declared as an Object is handled during deserialization.