JsonElement 結構

定義

表示 JsonDocument 內的特定 JSON 值。

public value class JsonElement
public readonly struct JsonElement
type JsonElement = struct
Public Structure JsonElement
繼承
JsonElement

備註

如需詳細資訊,請參閱 使用 JsonDocument 存取資料

屬性

Item[Int32]

取得目前值為 Array 時位於指定索引的值。

ValueKind

取得目前 JSON 值的類型。

方法

Clone()

取得可安全儲存超過原始 JsonDocument 存留期的 JsonElement。

EnumerateArray()

取得列舉值,列舉此 JsonElement 所表示 JSON 陣列中的值。

EnumerateObject()

取得列舉值,列舉此 JsonElement 所表示 JSON 物件中的屬性。

GetArrayLength()

取得目前陣列值內所包含的值數目。

GetBoolean()

取得 Boolean 形式的項目值。

GetByte()

取得 Byte 形式的目前 JSON 數字。

GetBytesFromBase64()

取得元素的值作為位元組陣列。

GetDateTime()

取得 DateTime 形式的項目值。

GetDateTimeOffset()

取得 DateTimeOffset 形式的項目值。

GetDecimal()

取得 Decimal 形式的目前 JSON 數字。

GetDouble()

取得 Double 形式的目前 JSON 數字。

GetGuid()

取得 Guid 形式的項目值。

GetInt16()

取得 Int16 形式的目前 JSON 數字。

GetInt32()

取得 Int32 形式的目前 JSON 數字。

GetInt64()

取得 Int64 形式的目前 JSON 數字。

GetProperty(ReadOnlySpan<Byte>)

取得 JsonElement,表示 utf8PropertyName 所識別的必要屬性值。

GetProperty(ReadOnlySpan<Char>)

取得 JsonElement,表示 propertyName 所識別的必要屬性值。

GetProperty(String)

取得 JsonElement,表示 propertyName 所識別的必要屬性值。

GetRawText()

取得字串,表示支援此值的原始輸入資料。

GetSByte()

取得 SByte 形式的目前 JSON 數字。

GetSingle()

取得 Single 形式的目前 JSON 數字。

GetString()

取得 String 形式的項目值。

GetUInt16()

取得 UInt16 形式的目前 JSON 數字。

GetUInt32()

取得 UInt32 形式的目前 JSON 數字。

GetUInt64()

取得 UInt64 形式的目前 JSON 數字。

ParseValue(Utf8JsonReader)

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

ToString()

取得適用於實值型別的目前值字串表示。

TryGetByte(Byte)

嘗試以 Byte 表示目前的 JSON 數字。

TryGetBytesFromBase64(Byte[])

假設 JSON 字串已經過 Base 64 編碼,並嘗試以位元組陣列加以表示。

TryGetDateTime(DateTime)

嘗試以 DateTime 表示目前的 JSON 字串。

TryGetDateTimeOffset(DateTimeOffset)

嘗試以 DateTimeOffset 表示目前的 JSON 字串。

TryGetDecimal(Decimal)

嘗試以 Decimal 表示目前的 JSON 數字。

TryGetDouble(Double)

嘗試以 Double 表示目前的 JSON 數字。

TryGetGuid(Guid)

嘗試以 Guid 表示目前的 JSON 字串。

TryGetInt16(Int16)

嘗試以 Int16 表示目前的 JSON 數字。

TryGetInt32(Int32)

嘗試以 Int32 表示目前的 JSON 數字。

TryGetInt64(Int64)

嘗試以 Int64 表示目前的 JSON 數字。

TryGetProperty(ReadOnlySpan<Byte>, JsonElement)

尋找目前物件中名為 utf8PropertyName 的屬性,並傳回指出這類屬性是否存在的值。 當屬性存在時,方法會將其值指派給 value 引數。

TryGetProperty(ReadOnlySpan<Char>, JsonElement)

尋找目前物件中名為 propertyName 的屬性,並傳回指出這類屬性是否存在的值。 當屬性存在時,方法會將其值指派給 value 引數。

TryGetProperty(String, JsonElement)

尋找目前物件中名為 propertyName 的屬性,並傳回指出這類屬性是否存在的值。 當屬性存在時,會將其值指派給 value 引數。

TryGetSByte(SByte)

嘗試以 SByte 表示目前的 JSON 數字。

TryGetSingle(Single)

嘗試以 Single 表示目前的 JSON 數字。

TryGetUInt16(UInt16)

嘗試以 UInt16 表示目前的 JSON 數字。

TryGetUInt32(UInt32)

嘗試以 UInt32 表示目前的 JSON 數字。

TryGetUInt64(UInt64)

嘗試以 UInt64 表示目前的 JSON 數字。

TryParseValue(Utf8JsonReader, Nullable<JsonElement>)

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

ValueEquals(ReadOnlySpan<Byte>)

比較 UTF8 編碼位元組範圍所呈現的文字與此元素的字串值。

ValueEquals(ReadOnlySpan<Char>)

比較指定的唯讀字元範圍與此元素的字串值。

ValueEquals(String)

比較指定字串與此元素的字串值。

WriteTo(Utf8JsonWriter)

將項目以 JSON 值格式寫入指定的寫入器。

擴充方法

Deserialize(JsonElement, JsonTypeInfo)

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

Deserialize(JsonElement, Type, JsonSerializerOptions)

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

Deserialize(JsonElement, Type, JsonSerializerContext)

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

Deserialize<TValue>(JsonElement, JsonSerializerOptions)

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

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

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

適用於