Skip to content

ParsedJsonDocument<T>.ParseAsync Method

Definition

Namespace: Corvus.Text.Json
Assembly: Corvus.Text.Json.dll
Source: ParsedJsonDocument.Parse.cs

ParseAsync(Stream, JsonDocumentOptions, CancellationToken)

Parse a Stream as UTF-8 encoded data representing a single JSON value into a ParsedJsonDocument. The Stream will be read to completion.

public static Task<ParsedJsonDocument<T>> ParseAsync(Stream utf8Json, JsonDocumentOptions options, CancellationToken cancellationToken)

Parameters

Name Type Description
utf8Json Stream JSON data to parse.
options JsonDocumentOptions Options to control the reader behavior during parsing. (optional)
cancellationToken CancellationToken The token to monitor for cancellation requests. (optional)

Returns

Task<ParsedJsonDocument<T>>

A Task to produce a ParsedJsonDocument representation of the JSON value.

Exceptions

Exception Description
JsonException utf8Json does not represent a valid single JSON value.
ArgumentException options contains unsupported options.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

Collaborate with us on GitHub

The source for this content can be found on GitHub, where you can also create and review issues and pull requests.

Open an issue