JsonNode.ParseAsync 方法

定义

Stream表示单个 JSON 值的 UTF-8 编码数据解析为 .JsonNode 流将读取到完成。

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)

参数

utf8Json
Stream

要分析的 JSON 文本。

nodeOptions
Nullable<JsonNodeOptions>

用于在分析后控制节点行为的选项。

documentOptions
JsonDocumentOptions

用于在分析过程中控制文档行为的选项。

cancellationToken
CancellationToken

用于监视取消请求的令牌。

返回

用于 Task 生成 JsonNode JSON 值的表示形式;如果输入表示 null JSON 值,则为 null。

例外

utf8Json 不表示有效的单个 JSON 值。

取消令牌已取消。 此异常存储在返回的任务中。

适用于