JsonNode.Parse 方法

定義

多載

Parse(String, Nullable<JsonNodeOptions>, JsonDocumentOptions)

剖析代表單一 JSON 值的文字。

Parse(ReadOnlySpan<Byte>, Nullable<JsonNodeOptions>, JsonDocumentOptions)

剖析代表單一 JSON 值的文字。

Parse(Utf8JsonReader, Nullable<JsonNodeOptions>)

從提供的讀取器剖析一個 JSON 值 (包括物件或陣列)。

Parse(Stream, Nullable<JsonNodeOptions>, JsonDocumentOptions)

Stream剖析為 UTF-8 編碼的數據,代表單一 JSON 值到 JsonNode。 Stream 將會讀取為完成。

Parse(String, Nullable<JsonNodeOptions>, JsonDocumentOptions)

來源:
JsonNode.Parse.cs
來源:
JsonNode.Parse.cs
來源:
JsonNode.Parse.cs

剖析代表單一 JSON 值的文字。

public static System.Text.Json.Nodes.JsonNode? Parse (string json, System.Text.Json.Nodes.JsonNodeOptions? nodeOptions = default, System.Text.Json.JsonDocumentOptions documentOptions = default);
static member Parse : string * Nullable<System.Text.Json.Nodes.JsonNodeOptions> * System.Text.Json.JsonDocumentOptions -> System.Text.Json.Nodes.JsonNode
Public Shared Function Parse (json As String, Optional nodeOptions As Nullable(Of JsonNodeOptions) = Nothing, Optional documentOptions As JsonDocumentOptions = Nothing) As JsonNode

參數

json
String

要剖析的 JSON 文字。

nodeOptions
Nullable<JsonNodeOptions>

在剖析之後控制節點行為的選項。

documentOptions
JsonDocumentOptions

在剖析期間控制檔行為的選項。

傳回

JsonNode JSON 值的表示法,如果輸入代表 Null JSON 值,則為 null。

例外狀況

jsonnull

json 不代表有效的單一 JSON 值。

適用於

Parse(ReadOnlySpan<Byte>, Nullable<JsonNodeOptions>, JsonDocumentOptions)

來源:
JsonNode.Parse.cs
來源:
JsonNode.Parse.cs
來源:
JsonNode.Parse.cs

剖析代表單一 JSON 值的文字。

public static System.Text.Json.Nodes.JsonNode? Parse (ReadOnlySpan<byte> utf8Json, System.Text.Json.Nodes.JsonNodeOptions? nodeOptions = default, System.Text.Json.JsonDocumentOptions documentOptions = default);
static member Parse : ReadOnlySpan<byte> * Nullable<System.Text.Json.Nodes.JsonNodeOptions> * System.Text.Json.JsonDocumentOptions -> System.Text.Json.Nodes.JsonNode
Public Shared Function Parse (utf8Json As ReadOnlySpan(Of Byte), Optional nodeOptions As Nullable(Of JsonNodeOptions) = Nothing, Optional documentOptions As JsonDocumentOptions = Nothing) As JsonNode

參數

utf8Json
ReadOnlySpan<Byte>

要剖析的 JSON 文字。

nodeOptions
Nullable<JsonNodeOptions>

在剖析之後控制節點行為的選項。

documentOptions
JsonDocumentOptions

在剖析期間控制檔行為的選項。

傳回

JsonNode JSON 值的表示法,如果輸入代表 Null JSON 值,則為 null。

例外狀況

utf8Json 不代表有效的單一 JSON 值。

適用於

Parse(Utf8JsonReader, Nullable<JsonNodeOptions>)

來源:
JsonNode.Parse.cs
來源:
JsonNode.Parse.cs
來源:
JsonNode.Parse.cs

從提供的讀取器剖析一個 JSON 值 (包括物件或陣列)。

public static System.Text.Json.Nodes.JsonNode? Parse (ref System.Text.Json.Utf8JsonReader reader, System.Text.Json.Nodes.JsonNodeOptions? nodeOptions = default);
static member Parse : Utf8JsonReader * Nullable<System.Text.Json.Nodes.JsonNodeOptions> -> System.Text.Json.Nodes.JsonNode
Public Shared Function Parse (ByRef reader As Utf8JsonReader, Optional nodeOptions As Nullable(Of JsonNodeOptions) = Nothing) As JsonNode

參數

reader
Utf8JsonReader

要讀取的讀取器。

nodeOptions
Nullable<JsonNodeOptions>

控制行為的選項。

傳回

JsonNode來自讀取器的 ,如果輸入代表 Null JSON 值,則為 null。

例外狀況

reader 正在使用不支援的選項。

目前的 reader 權杖不會啟動或表示值。

無法從讀取器讀取某個值。

備註

如果 的 TokenTypereader 屬性為 PropertyNameNone,則讀取器將會由一個呼叫進階, Read() 以判斷值的開頭。

完成這個方法時, reader 會位於 JSON 值的最後一個令牌。 如果擲回例外狀況,讀取器會重設為呼叫 方法時所在的狀態。

這個方法會建立讀取器所處理的數據複本,因此不需要呼叫端維護此方法傳回以外的數據完整性。

適用於

Parse(Stream, Nullable<JsonNodeOptions>, JsonDocumentOptions)

來源:
JsonNode.Parse.cs
來源:
JsonNode.Parse.cs
來源:
JsonNode.Parse.cs

Stream剖析為 UTF-8 編碼的數據,代表單一 JSON 值到 JsonNode。 Stream 將會讀取為完成。

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

參數

utf8Json
Stream

要剖析的 JSON 文字。

nodeOptions
Nullable<JsonNodeOptions>

在剖析之後控制節點行為的選項。

documentOptions
JsonDocumentOptions

在剖析期間控制檔行為的選項。

傳回

JsonNode JSON 值的表示法,如果輸入代表 Null JSON 值,則為 null。

例外狀況

utf8Json 不代表有效的單一 JSON 值。

適用於