JsonDocument.ParseAsync(Stream, JsonDocumentOptions, CancellationToken) Method

Definition

Parses a Stream as UTF-8-encoded data representing a single JSON value into a JsonDocument. The stream is read to completion.

public static System.Threading.Tasks.Task<System.Text.Json.JsonDocument> ParseAsync (System.IO.Stream utf8Json, System.Text.Json.JsonDocumentOptions options = default, System.Threading.CancellationToken cancellationToken = default);
static member ParseAsync : System.IO.Stream * System.Text.Json.JsonDocumentOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Text.Json.JsonDocument>
Public Shared Function ParseAsync (utf8Json As Stream, Optional options As JsonDocumentOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of JsonDocument)

Parameters

utf8Json
Stream

The JSON data to parse.

options
JsonDocumentOptions

Options to control the reader behavior during parsing.

cancellationToken
CancellationToken

The token to monitor for cancellation requests.

Returns

Task<JsonDocument>

A task to produce a JsonDocument representation of the JSON value.

Exceptions

utf8Json does not represent a valid single JSON value.

options contains unsupported options.

Applies to