Edit

Share via


JsonSerializer.DeserializeAsyncEnumerable Method

Definition

Overloads

DeserializeAsyncEnumerable<TValue>(PipeReader, JsonTypeInfo<TValue>, Boolean, CancellationToken)

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

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

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

DeserializeAsyncEnumerable<TValue>(Stream, Boolean, JsonSerializerOptions, CancellationToken)

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

DeserializeAsyncEnumerable<TValue>(PipeReader, Boolean, JsonSerializerOptions, CancellationToken)

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

DeserializeAsyncEnumerable<TValue>(PipeReader, 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.

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.

DeserializeAsyncEnumerable<TValue>(PipeReader, 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>(PipeReader, JsonTypeInfo<TValue>, Boolean, CancellationToken)

Source:
JsonSerializer.Read.Pipe.cs

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

public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Pipelines.PipeReader utf8Json, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, bool topLevelValues, System.Threading.CancellationToken cancellationToken = default);
static member DeserializeAsyncEnumerable : System.IO.Pipelines.PipeReader * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * bool * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
Public Function DeserializeAsyncEnumerable(Of TValue) (utf8Json As PipeReader, jsonTypeInfo As JsonTypeInfo(Of TValue), topLevelValues As Boolean, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)

Type Parameters

TValue

The element type to deserialize asynchronously.

Parameters

utf8Json
PipeReader

JSON data to parse.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadata about the element type to convert.

topLevelValues
Boolean

Whether to deserialize from a sequence of top-level JSON values.

cancellationToken
CancellationToken

The CancellationToken that can be used to cancel the read operation.

Returns

An IAsyncEnumerable<T> representation of the provided JSON sequence.

Exceptions

utf8Json or jsonTypeInfo is null.

Remarks

When topLevelValues is set to true, treats the PipeReader as a sequence of whitespace separated top-level JSON values and attempts to deserialize each value into TValue.

When topLevelValues is set to false, treats the PipeReader as a JSON array and attempts to serialize each element into TValue.

Applies to

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

Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs

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

public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Stream utf8Json, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, bool topLevelValues, System.Threading.CancellationToken cancellationToken = default);
static member DeserializeAsyncEnumerable : System.IO.Stream * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * bool * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
Public Function DeserializeAsyncEnumerable(Of TValue) (utf8Json As Stream, jsonTypeInfo As JsonTypeInfo(Of TValue), topLevelValues As Boolean, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)

Type Parameters

TValue

The element type to deserialize asynchronously.

Parameters

utf8Json
Stream

JSON data to parse.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadata about the element type to convert.

topLevelValues
Boolean

Whether to deserialize from a sequence of top-level JSON values.

cancellationToken
CancellationToken

The CancellationToken that can be used to cancel the read operation.

Returns

An IAsyncEnumerable<T> representation of the provided JSON sequence.

Exceptions

utf8Json or jsonTypeInfo is null.

Remarks

When topLevelValues is set to true, treats the stream as a sequence of whitespace separated top-level JSON values and attempts to deserialize each value into TValue.

When topLevelValues is set to false, treats the stream as a JSON array and attempts to serialize each element into TValue.

Applies to

DeserializeAsyncEnumerable<TValue>(Stream, Boolean, JsonSerializerOptions, CancellationToken)

Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs

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

[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Stream utf8Json, bool topLevelValues, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Stream utf8Json, bool topLevelValues, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member DeserializeAsyncEnumerable : System.IO.Stream * bool * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
static member DeserializeAsyncEnumerable : System.IO.Stream * bool * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
Public Function DeserializeAsyncEnumerable(Of TValue) (utf8Json As Stream, topLevelValues As Boolean, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)

Type Parameters

TValue

The element type to deserialize asynchronously.

Parameters

utf8Json
Stream

JSON data to parse.

topLevelValues
Boolean

true to deserialize from a sequence of top-level JSON values, or false to deserialize from a single top-level array.

options
JsonSerializerOptions

Options to control the behavior during reading.

cancellationToken
CancellationToken

The CancellationToken that can be used to cancel the read operation.

Returns

An IAsyncEnumerable<T> representation of the provided JSON sequence.

Attributes

Exceptions

utf8Json is null.

Remarks

When topLevelValues is set to true, treats the stream as a sequence of whitespace separated top-level JSON values and attempts to deserialize each value into TValue.

When topLevelValues is set to false, treats the stream as a JSON array and attempts to serialize each element into TValue.

Applies to

DeserializeAsyncEnumerable<TValue>(PipeReader, Boolean, JsonSerializerOptions, CancellationToken)

Source:
JsonSerializer.Read.Pipe.cs

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

[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Pipelines.PipeReader utf8Json, bool topLevelValues, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Pipelines.PipeReader utf8Json, bool topLevelValues, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member DeserializeAsyncEnumerable : System.IO.Pipelines.PipeReader * bool * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
static member DeserializeAsyncEnumerable : System.IO.Pipelines.PipeReader * bool * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
Public Function DeserializeAsyncEnumerable(Of TValue) (utf8Json As PipeReader, topLevelValues As Boolean, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)

Type Parameters

TValue

The element type to deserialize asynchronously.

Parameters

utf8Json
PipeReader

JSON data to parse.

topLevelValues
Boolean

true to deserialize from a sequence of top-level JSON values, or false to deserialize from a single top-level array.

options
JsonSerializerOptions

Options to control the behavior during reading.

cancellationToken
CancellationToken

The CancellationToken that can be used to cancel the read operation.

Returns

An IAsyncEnumerable<T> representation of the provided JSON sequence.

Attributes

Exceptions

utf8Json is null.

Remarks

When topLevelValues is set to true, treats the PipeReader as a sequence of whitespace separated top-level JSON values and attempts to deserialize each value into TValue.

When topLevelValues is set to false, treats the PipeReader as a JSON array and attempts to serialize each element into TValue.

Applies to

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

Source:
JsonSerializer.Read.Pipe.cs

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

public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Pipelines.PipeReader utf8Json, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member DeserializeAsyncEnumerable : System.IO.Pipelines.PipeReader * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
Public Function DeserializeAsyncEnumerable(Of TValue) (utf8Json As PipeReader, jsonTypeInfo As JsonTypeInfo(Of TValue), Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)

Type Parameters

TValue

The element type to deserialize asynchronously.

Parameters

utf8Json
PipeReader

JSON data to parse.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadata about the element type to convert.

cancellationToken
CancellationToken

The CancellationToken that can be used to cancel the read operation.

Returns

An IAsyncEnumerable<T> representation of the provided JSON array.

Exceptions

utf8Json or jsonTypeInfo is null.

Applies to

DeserializeAsyncEnumerable<TValue>(Stream, JsonSerializerOptions, CancellationToken)

Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs

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

[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Stream utf8Json, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Stream utf8Json, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Stream utf8Json, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member DeserializeAsyncEnumerable : System.IO.Stream * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member DeserializeAsyncEnumerable : System.IO.Stream * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
static member DeserializeAsyncEnumerable : System.IO.Stream * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
Public Function DeserializeAsyncEnumerable(Of TValue) (utf8Json As Stream, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)

Type Parameters

TValue

The element type to deserialize asynchronously.

Parameters

utf8Json
Stream

JSON data to parse.

options
JsonSerializerOptions

Options to control the behavior during reading.

cancellationToken
CancellationToken

The CancellationToken that can be used to cancel the read operation.

Returns

An IAsyncEnumerable<T> representation of the provided JSON array.

Attributes

Exceptions

utf8Json is null.

The cancellation token was canceled. This exception is stored into the returned task.

Applies to

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

Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs
Source:
JsonSerializer.Read.Stream.cs

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

public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Stream utf8Json, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member DeserializeAsyncEnumerable : System.IO.Stream * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
Public Function DeserializeAsyncEnumerable(Of TValue) (utf8Json As Stream, jsonTypeInfo As JsonTypeInfo(Of TValue), Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)

Type Parameters

TValue

The element type to deserialize asynchronously.

Parameters

utf8Json
Stream

JSON data to parse.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadata about the element type to convert.

cancellationToken
CancellationToken

The CancellationToken that can be used to cancel the read operation.

Returns

An IAsyncEnumerable<T> representation of the provided JSON array.

Exceptions

utf8Json or jsonTypeInfo is null.

The cancellation token was canceled. This exception is stored into the returned task.

Applies to

DeserializeAsyncEnumerable<TValue>(PipeReader, JsonSerializerOptions, CancellationToken)

Source:
JsonSerializer.Read.Pipe.cs

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

[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Pipelines.PipeReader utf8Json, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
public static System.Collections.Generic.IAsyncEnumerable<TValue?> DeserializeAsyncEnumerable<TValue>(System.IO.Pipelines.PipeReader utf8Json, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member DeserializeAsyncEnumerable : System.IO.Pipelines.PipeReader * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
static member DeserializeAsyncEnumerable : System.IO.Pipelines.PipeReader * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Collections.Generic.IAsyncEnumerable<'Value>
Public Function DeserializeAsyncEnumerable(Of TValue) (utf8Json As PipeReader, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As IAsyncEnumerable(Of TValue)

Type Parameters

TValue

The element type to deserialize asynchronously.

Parameters

utf8Json
PipeReader

JSON data to parse.

options
JsonSerializerOptions

Options to control the behavior during reading.

cancellationToken
CancellationToken

The CancellationToken that can be used to cancel the read operation.

Returns

An IAsyncEnumerable<T> representation of the provided JSON array.

Attributes

Exceptions

utf8Json is null.

Applies to