JsonNode.ParseAsync 方法

定義

Stream剖析為 UTF-8 編碼的數據,代表單一 JSON 值到 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 值。

取消令牌已取消。 此例外狀況會儲存在傳回的工作中。

適用於