JsonDocument 類別

定義

提供機制用於檢查 JSON 值的結構化內容,而不需自動具現化資料值。Provides a mechanism for examining the structural content of a JSON value without automatically instantiating data values.

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

備註

這個類別會利用來自集區記憶體的資源,將垃圾收集行程(GC)的影響降至最低。This class utilizes resources from pooled memory to minimize the impact of the garbage collector (GC) in high-usage scenarios. 若無法正確處置此物件,將會導致記憶體不會傳回集區,這會增加架構各個部分的 GC 影響。Failure to properly dispose this object will result in the memory not being returned to the pool, which will increase GC impact across various parts of the framework.

如需詳細資訊,請參閱如何序列化和還原序列化 JSONFor more information, see How to serialize and deserialize JSON.

屬性

RootElement

取得此 JSON 文件的根項目。Gets the root element of this JSON document.

方法

Dispose()

釋放這個 JsonDocument 執行個體所使用的資源。Releases the resources used by this JsonDocument instance.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
GetHashCode()

作為預設雜湊函數。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

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

將記憶體剖析為 UTF-8 編碼的文字,將單一 JSON 位元組值表示為 JsonDocument。Parses memory as UTF-8-encoded text representing a single JSON byte value into a JsonDocument.

Parse(ReadOnlyMemory<Char>, JsonDocumentOptions)

將表示單一 JSON 字元值的文字剖析為 JsonDocument。Parses text representing a single JSON character value into a JsonDocument.

Parse(ReadOnlySequence<Byte>, JsonDocumentOptions)

將序列剖析為 UTF-8 編碼的文字,將單一 JSON 位元組值表示為 JsonDocument。Parses a sequence as UTF-8-encoded text representing a single JSON byte value into a JsonDocument.

Parse(Stream, JsonDocumentOptions)

Stream 剖析為 UTF-8 編碼的資料,將單一 JSON 值表示為 JsonDocument。Parses a Stream as UTF-8-encoded data representing a single JSON value into a JsonDocument. 資料流讀取完成。The stream is read to completion.

Parse(String, JsonDocumentOptions)

將表示單一 JSON 字串值的文字剖析為 JsonDocument。Parses text representing a single JSON string value into a JsonDocument.

ParseAsync(Stream, JsonDocumentOptions, CancellationToken)

Stream 剖析為 UTF-8 編碼的資料,將單一 JSON 值表示為 JsonDocument。Parses a Stream as UTF-8-encoded data representing a single JSON value into a JsonDocument. 資料流讀取完成。The stream is read to completion.

ParseValue(Utf8JsonReader)

從提供的讀取器剖析一個 JSON 值 (包括物件或陣列)。Parses one JSON value (including objects or arrays) from the provided reader.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

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

會嘗試從提供的讀取器剖析一個 JSON 值 (包括物件或陣列)。Attempts to parse one JSON value (including objects or arrays) from the provided reader.

WriteTo(Utf8JsonWriter)

將元素以 JSON 值形式寫入提供的寫入器。Writes the document to the provided writer as a JSON value.

適用於