System.Text.Json.Serialization 命名空间

包含一些类,这些类通过属性模型或通过类型转换器自定义和扩展对象到 JSON 格式文档或流的序列化和反序列化。 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.

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

将对象或值转换为 JSON,或是从 JSON 转换为对象或值。Converts an object or value to or from JSON.

JsonConverter<T>

将对象或值转换为 JSON,或是从 JSON 转换为对象或值。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.

JsonExtensionDataAttribute

当属性的类型为 IDictionary<TKey,TValue> 时,没有匹配成员的任何属性都会在反序列化期间添加到该字典中,并在序列化期间中写入。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

当放置在类型、属性或字段上时,指示在序列化或反序列化数字时应使用的 JsonNumberHandling 设置。When placed on a type, property, or field, indicates what JsonNumberHandling settings should be used when serializing or deserializing numbers.

JsonPropertyNameAttribute

指定序列化和反序列化时 JSON 中存在的属性名称。Specifies the property name that is present in the JSON when serializing and deserializing. 这将重写 JsonNamingPolicy 指定的任何命名策略。This overrides any naming policy specified by JsonNamingPolicy.

JsonStringEnumConverter

将枚举值转换为字符串以及从字符串转换为枚举值。Converts enumeration values to and from strings.

ReferenceHandler

此类定义 JsonSerializer 如何处理对序列化和反序列化的引用。This class defines how the JsonSerializer deals with references on serialization and deserialization.

ReferenceHandler<T>

此类定义 JsonSerializer 如何处理对序列化和反序列化的引用。This class defines how the JsonSerializer deals with references on serialization and deserialization.

ReferenceResolver

此类定义 JsonSerializer 如何处理对序列化和反序列化的引用。This class defines how the JsonSerializer deals with references on serialization and deserialization. 定义在序列化和反序列化过程中保留引用的核心行为。Defines the core behavior of preserving references on serialization and deserialization.

枚举

JsonIgnoreCondition

控制 JsonIgnoreAttribute 如何忽略序列化和反序列化时的属性。Controls how the JsonIgnoreAttribute ignores properties on serialization and deserialization.

JsonNumberHandling

确定在序列化和反序列化时 JsonSerializer 如何处理数字。Determines how JsonSerializer handles numbers when serializing and deserializing.