JsonDocument 類別

定義

提供機制用於檢查 JSON 值的結構化內容,而不需自動具現化資料值。

public ref class JsonDocument sealed : IDisposable
public sealed class JsonDocument : IDisposable
type JsonDocument = class
    interface IDisposable
Public NotInheritable Class JsonDocument
Implements IDisposable
繼承
JsonDocument
實作

備註

這個類別會利用集區記憶體中的資源,將垃圾收集行程 (GC) 在高使用量案例中的影響降到最低。 無法正確處置此物件會導致記憶體未傳回至集區,這會增加架構各個部分的 GC 影響。

如需詳細資訊,請參閱 如何在 System.Text.Json 中使用 JSON DOM、Utf8JsonReader 和 Utf8JsonWriter

屬性

RootElement

取得此 JSON 文件的根項目。

方法

Dispose()

釋放這個 JsonDocument 執行個體所使用的資源。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
Parse(ReadOnlyMemory<Byte>, JsonDocumentOptions)

將記憶體剖析為 UTF-8 編碼的文字,代表單一 JSON 值到 JsonDocument。

Parse(ReadOnlyMemory<Char>, JsonDocumentOptions)

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

Parse(ReadOnlySequence<Byte>, JsonDocumentOptions)

將序列剖析為 UTF-8 編碼的文字,代表單一 JSON 值到 JsonDocument。

Parse(Stream, JsonDocumentOptions)

Stream 剖析為 UTF-8 編碼的資料,將單一 JSON 值表示為 JsonDocument。 資料流讀取完成。

Parse(String, JsonDocumentOptions)

將表示單一 JSON 字串值的文字剖析為 JsonDocument。

ParseAsync(Stream, JsonDocumentOptions, CancellationToken)

Stream 剖析為 UTF-8 編碼的資料,將單一 JSON 值表示為 JsonDocument。 資料流讀取完成。

ParseValue(Utf8JsonReader)

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

ToString()

傳回代表目前物件的字串。

(繼承來源 Object)
TryParseValue(Utf8JsonReader, JsonDocument)

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

WriteTo(Utf8JsonWriter)

將元素以 JSON 值形式寫入提供的寫入器。

擴充方法

Deserialize(JsonDocument, JsonTypeInfo)

JsonDocument 表示單一 JSON 值的 轉換為 所 jsonTypeInfo 指定的實例。

Deserialize(JsonDocument, Type, JsonSerializerOptions)

JsonDocument 表示單一 JSON 值的 returnType 轉換成 。

Deserialize(JsonDocument, Type, JsonSerializerContext)

JsonDocument 表示單一 JSON 值的 returnType 轉換成 。

Deserialize<TValue>(JsonDocument, JsonSerializerOptions)

JsonDocument 表示單一 JSON 值的 TValue 轉換成 。

Deserialize<TValue>(JsonDocument, JsonTypeInfo<TValue>)

JsonDocument 表示單一 JSON 值的 TValue 轉換成 。

適用於