JsonSerializer.DeserializeAsyncEnumerable<TValue>(Stream, JsonSerializerOptions, CancellationToken) Method

Definition

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.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
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 which may be used to cancel the read operation.

Returns

IAsyncEnumerable<TValue>

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

Exceptions

utf8Json is null.

Applies to