JsonSerializer Class

Definition

Provides functionality to serialize objects or value types to JSON and to deserialize JSON into objects or value types.

public ref class JsonSerializer abstract sealed
public static class JsonSerializer
type JsonSerializer = class
Public Class JsonSerializer
Public Module JsonSerializer
Inheritance
JsonSerializer

Remarks

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

Properties

IsReflectionEnabledByDefault

Gets a value that indicates whether unconfigured JsonSerializerOptions instances should default to the reflection-based DefaultJsonTypeInfoResolver.

Methods

Deserialize(JsonDocument, JsonTypeInfo)

Converts the JsonDocument representing a single JSON value into an instance specified by the jsonTypeInfo.

Deserialize(JsonDocument, Type, JsonSerializerContext)

Converts the JsonDocument representing a single JSON value into a returnType.

Deserialize(JsonDocument, Type, JsonSerializerOptions)

Converts the JsonDocument representing a single JSON value into a returnType.

Deserialize(JsonElement, JsonTypeInfo)

Converts the JsonElement representing a single JSON value into an instance specified by the jsonTypeInfo.

Deserialize(JsonElement, Type, JsonSerializerContext)

Converts the JsonElement representing a single JSON value into a returnType.

Deserialize(JsonElement, Type, JsonSerializerOptions)

Converts the JsonElement representing a single JSON value into a returnType.

Deserialize(JsonNode, JsonTypeInfo)

Converts the JsonNode representing a single JSON value into an instance specified by the jsonTypeInfo.

Deserialize(JsonNode, Type, JsonSerializerContext)

Converts the JsonNode representing a single JSON value into a returnType.

Deserialize(JsonNode, Type, JsonSerializerOptions)

Converts the JsonNode representing a single JSON value into a returnType.

Deserialize(ReadOnlySpan<Byte>, JsonTypeInfo)

Parses the UTF-8 encoded text representing a single JSON value into an instance specified by the jsonTypeInfo.

Deserialize(ReadOnlySpan<Byte>, Type, JsonSerializerContext)

Parses the UTF-8 encoded text representing a single JSON value into a returnType.

Deserialize(ReadOnlySpan<Byte>, Type, JsonSerializerOptions)

Parses the UTF-8 encoded text representing a single JSON value into an instance of a specified type.

Deserialize(ReadOnlySpan<Char>, JsonTypeInfo)

Parses the text representing a single JSON value into an instance specified by the jsonTypeInfo.

Deserialize(ReadOnlySpan<Char>, Type, JsonSerializerContext)

Parses the text representing a single JSON value into a returnType.

Deserialize(ReadOnlySpan<Char>, Type, JsonSerializerOptions)

Parses the text representing a single JSON value into an instance of a specified type.

Deserialize(Stream, JsonTypeInfo)

Reads the UTF-8 encoded text representing a single JSON value into an instance specified by the jsonTypeInfo. The Stream will be read to completion.

Deserialize(Stream, Type, JsonSerializerContext)

Reads the UTF-8 encoded text representing a single JSON value into a returnType. The Stream will be read to completion.

Deserialize(Stream, Type, JsonSerializerOptions)

Reads the UTF-8 encoded text representing a single JSON value into a returnType. The Stream will be read to completion.

Deserialize(String, JsonTypeInfo)

Parses the text representing a single JSON value into an instance specified by the jsonTypeInfo.

Deserialize(String, Type, JsonSerializerContext)

Parses the text representing a single JSON value into a returnType.

Deserialize(String, Type, JsonSerializerOptions)

Parses the text representing a single JSON value into an instance of a specified type.

Deserialize(Utf8JsonReader, JsonTypeInfo)

Reads one JSON value (including objects or arrays) from the provided reader into an instance specified by the jsonTypeInfo.

Deserialize(Utf8JsonReader, Type, JsonSerializerContext)

Reads one JSON value (including objects or arrays) from the provided reader into a returnType.

Deserialize(Utf8JsonReader, Type, JsonSerializerOptions)

Reads one JSON value (including objects or arrays) from the provided reader and converts it into an instance of a specified type.

Deserialize<TValue>(JsonDocument, JsonSerializerOptions)

Converts the JsonDocument representing a single JSON value into a TValue.

Deserialize<TValue>(JsonDocument, JsonTypeInfo<TValue>)

Converts the JsonDocument representing a single JSON value into a TValue.

Deserialize<TValue>(JsonElement, JsonSerializerOptions)

Converts the JsonElement representing a single JSON value into a TValue.

Deserialize<TValue>(JsonElement, JsonTypeInfo<TValue>)

Converts the JsonElement representing a single JSON value into a TValue.

Deserialize<TValue>(JsonNode, JsonSerializerOptions)

Converts the JsonNode representing a single JSON value into a TValue.

Deserialize<TValue>(JsonNode, JsonTypeInfo<TValue>)

Converts the JsonNode representing a single JSON value into a TValue.

Deserialize<TValue>(ReadOnlySpan<Byte>, JsonSerializerOptions)

Parses the UTF-8 encoded text representing a single JSON value into an instance of the type specified by a generic type parameter.

Deserialize<TValue>(ReadOnlySpan<Byte>, JsonTypeInfo<TValue>)

Parses the UTF-8 encoded text representing a single JSON value into a TValue.

Deserialize<TValue>(ReadOnlySpan<Char>, JsonSerializerOptions)

Parses the text representing a single JSON value into an instance of the type specified by a generic type parameter.

Deserialize<TValue>(ReadOnlySpan<Char>, JsonTypeInfo<TValue>)

Parses the text representing a single JSON value into a TValue.

Deserialize<TValue>(Stream, JsonSerializerOptions)

Reads the UTF-8 encoded text representing a single JSON value into a TValue. The Stream will be read to completion.

Deserialize<TValue>(Stream, JsonTypeInfo<TValue>)

Reads the UTF-8 encoded text representing a single JSON value into a TValue. The Stream will be read to completion.

Deserialize<TValue>(String, JsonSerializerOptions)

Parses the text representing a single JSON value into an instance of the type specified by a generic type parameter.

Deserialize<TValue>(String, JsonTypeInfo<TValue>)

Parses the text representing a single JSON value into a TValue.

Deserialize<TValue>(Utf8JsonReader, JsonSerializerOptions)

Reads one JSON value (including objects or arrays) from the provided reader into an instance of the type specified by a generic type parameter.

Deserialize<TValue>(Utf8JsonReader, JsonTypeInfo<TValue>)

Reads one JSON value (including objects or arrays) from the provided reader into a TValue.

DeserializeAsync(Stream, JsonTypeInfo, CancellationToken)

Reads the UTF-8 encoded text representing a single JSON value into an instance specified by the jsonTypeInfo. The Stream will be read to completion.

DeserializeAsync(Stream, Type, JsonSerializerContext, CancellationToken)

Reads the UTF-8 encoded text representing a single JSON value into a returnType. The Stream will be read to completion.

DeserializeAsync(Stream, Type, JsonSerializerOptions, CancellationToken)

Asynchronously reads the UTF-8 encoded text representing a single JSON value into an instance of a specified type. The stream will be read to completion.

DeserializeAsync<TValue>(Stream, JsonSerializerOptions, CancellationToken)

Asynchronously reads the UTF-8 encoded text representing a single JSON value into an instance of a type specified by a generic type parameter. The stream will be read to completion.

DeserializeAsync<TValue>(Stream, JsonTypeInfo<TValue>, CancellationToken)

Reads the UTF-8 encoded text representing a single JSON value into a TValue. The Stream will be read to completion.

DeserializeAsyncEnumerable<TValue>(Stream, JsonSerializerOptions, CancellationToken)

Wraps the UTF-8 encoded text into an IAsyncEnumerable<T> that can be used to deserialize root-level JSON arrays in a streaming manner.

DeserializeAsyncEnumerable<TValue>(Stream, JsonTypeInfo<TValue>, CancellationToken)

Wraps the UTF-8 encoded text into an IAsyncEnumerable<T> that can be used to deserialize root-level JSON arrays in a streaming manner.

Serialize(Object, JsonTypeInfo)

Converts the provided value into a String.

Serialize(Object, Type, JsonSerializerContext)

Converts the provided value into a String.

Serialize(Object, Type, JsonSerializerOptions)

Converts the value of a specified type into a JSON string.

Serialize(Stream, Object, JsonTypeInfo)

Converts the provided value to UTF-8 encoded JSON text and write it to the Stream.

Serialize(Stream, Object, Type, JsonSerializerContext)

Converts the provided value to UTF-8 encoded JSON text and write it to the Stream.

Serialize(Stream, Object, Type, JsonSerializerOptions)

Converts the provided value to UTF-8 encoded JSON text and write it to the Stream.

Serialize(Utf8JsonWriter, Object, JsonTypeInfo)

Writes one JSON value (including objects or arrays) to the provided writer.

Serialize(Utf8JsonWriter, Object, Type, JsonSerializerContext)

Writes one JSON value (including objects or arrays) to the provided writer.

Serialize(Utf8JsonWriter, Object, Type, JsonSerializerOptions)

Writes the JSON representation of the specified type to the provided writer.

Serialize<TValue>(Stream, TValue, JsonSerializerOptions)

Converts the provided value to UTF-8 encoded JSON text and write it to the Stream.

Serialize<TValue>(Stream, TValue, JsonTypeInfo<TValue>)

Converts the provided value to UTF-8 encoded JSON text and write it to the Stream.

Serialize<TValue>(TValue, JsonSerializerOptions)

Converts the value of a type specified by a generic type parameter into a JSON string.

Serialize<TValue>(TValue, JsonTypeInfo<TValue>)

Converts the provided value into a String.

Serialize<TValue>(Utf8JsonWriter, TValue, JsonSerializerOptions)

Writes the JSON representation of a type specified by a generic type parameter to the provided writer.

Serialize<TValue>(Utf8JsonWriter, TValue, JsonTypeInfo<TValue>)

Writes one JSON value (including objects or arrays) to the provided writer.

SerializeAsync(Stream, Object, JsonTypeInfo, CancellationToken)

Converts the provided value to UTF-8 encoded JSON text and writes it to the Stream.

SerializeAsync(Stream, Object, Type, JsonSerializerContext, CancellationToken)

Converts the provided value to UTF-8 encoded JSON text and write it to the Stream.

SerializeAsync(Stream, Object, Type, JsonSerializerOptions, CancellationToken)

Asynchronously converts the value of a specified type to UTF-8 encoded JSON text and writes it to the specified stream.

SerializeAsync<TValue>(Stream, TValue, JsonSerializerOptions, CancellationToken)

Asynchronously converts a value of a type specified by a generic type parameter to UTF-8 encoded JSON text and writes it to a stream.

SerializeAsync<TValue>(Stream, TValue, JsonTypeInfo<TValue>, CancellationToken)

Converts the provided value to UTF-8 encoded JSON text and write it to the Stream.

SerializeToDocument(Object, JsonTypeInfo)

Converts the provided value into a JsonDocument.

SerializeToDocument(Object, Type, JsonSerializerContext)

Converts the provided value into a JsonDocument.

SerializeToDocument(Object, Type, JsonSerializerOptions)

Converts the provided value into a JsonDocument.

SerializeToDocument<TValue>(TValue, JsonSerializerOptions)

Converts the provided value into a JsonDocument.

SerializeToDocument<TValue>(TValue, JsonTypeInfo<TValue>)

Converts the provided value into a JsonDocument.

SerializeToElement(Object, JsonTypeInfo)

Converts the provided value into a JsonElement.

SerializeToElement(Object, Type, JsonSerializerContext)

Converts the provided value into a JsonDocument.

SerializeToElement(Object, Type, JsonSerializerOptions)

Converts the provided value into a JsonDocument.

SerializeToElement<TValue>(TValue, JsonSerializerOptions)

Converts the provided value into a JsonDocument.

SerializeToElement<TValue>(TValue, JsonTypeInfo<TValue>)

Converts the provided value into a JsonDocument.

SerializeToNode(Object, JsonTypeInfo)

Converts the provided value into a JsonNode.

SerializeToNode(Object, Type, JsonSerializerContext)

Converts the provided value into a JsonNode.

SerializeToNode(Object, Type, JsonSerializerOptions)

Converts the provided value into a JsonNode.

SerializeToNode<TValue>(TValue, JsonSerializerOptions)

Converts the provided value into a JsonNode.

SerializeToNode<TValue>(TValue, JsonTypeInfo<TValue>)

Converts the provided value into a JsonNode.

SerializeToUtf8Bytes(Object, JsonTypeInfo)

Converts the provided value into a Byte array.

SerializeToUtf8Bytes(Object, Type, JsonSerializerContext)

Converts the provided value into a Byte array.

SerializeToUtf8Bytes(Object, Type, JsonSerializerOptions)

Converts a value of the specified type into a JSON string, encoded as UTF-8 bytes.

SerializeToUtf8Bytes<TValue>(TValue, JsonSerializerOptions)

Converts the value of a type specified by a generic type parameter into a JSON string, encoded as UTF-8 bytes.

SerializeToUtf8Bytes<TValue>(TValue, JsonTypeInfo<TValue>)

Converts the provided value into a Byte array.

Applies to