JsonDocument.ParseAsync(Stream, JsonDocumentOptions, CancellationToken) 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 = null, System.Threading.CancellationToken cancellationToken = null);
static member ParseAsync : System.IO.Stream * System.Text.Json.JsonDocumentOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Text.Json.JsonDocument>

Parameters

utf8Json
Stream Stream

The JSON data to parse.

options
JsonDocumentOptions JsonDocumentOptions

Options to control the reader behavior during parsing.

cancellationToken
CancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

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

Exceptions

utf8Json does not represent a valid single JSON value.

readerOptions contains unsupported options.

Applies to