Redigera

Dela via


JsonNode.ParseAsync Method

Definition

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

public static System.Threading.Tasks.Task<System.Text.Json.Nodes.JsonNode?> ParseAsync (System.IO.Stream utf8Json, System.Text.Json.Nodes.JsonNodeOptions? nodeOptions = default, System.Text.Json.JsonDocumentOptions documentOptions = default, System.Threading.CancellationToken cancellationToken = default);
static member ParseAsync : System.IO.Stream * Nullable<System.Text.Json.Nodes.JsonNodeOptions> * System.Text.Json.JsonDocumentOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Text.Json.Nodes.JsonNode>
Public Shared Function ParseAsync (utf8Json As Stream, Optional nodeOptions As Nullable(Of JsonNodeOptions) = Nothing, Optional documentOptions As JsonDocumentOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of JsonNode)

Parameters

utf8Json
Stream

The JSON text to parse.

nodeOptions
Nullable<JsonNodeOptions>

Options to control the node behavior after parsing.

documentOptions
JsonDocumentOptions

Options to control the document behavior during parsing.

cancellationToken
CancellationToken

The token to monitor for cancellation requests.

Returns

A Task to produce either a JsonNode representation of the JSON value, or null if the input represents the null JSON value.

Exceptions

utf8Json does not represent a valid single JSON value.

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

Applies to