JsonElement.Parse 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| Parse(String, JsonDocumentOptions) |
將代表單一 JSON 值的文字解析成 JsonElement。 |
| Parse(ReadOnlySpan<Byte>, JsonDocumentOptions) |
解析表示單一 JSON 值的 UTF8 編碼文字。JsonElement |
| Parse(ReadOnlySpan<Char>, JsonDocumentOptions) |
將代表單一 JSON 值的文字解析成 JsonElement。 |
Parse(String, JsonDocumentOptions)
將代表單一 JSON 值的文字解析成 JsonElement。
public static System.Text.Json.JsonElement Parse(string json, System.Text.Json.JsonDocumentOptions options = default);
static member Parse : string * System.Text.Json.JsonDocumentOptions -> System.Text.Json.JsonElement
Public Shared Function Parse (json As String, Optional options As JsonDocumentOptions = Nothing) As JsonElement
參數
- json
- String
要解析的 JSON 文字。
- options
- JsonDocumentOptions
在解析過程中控制讀取器行為的選項。
傳回
JSON 值的 JsonElement 表示。
例外狀況
json 是 null。
json 不代表有效的單一 JSON 值。
options 包含不支援的選項。
適用於
Parse(ReadOnlySpan<Byte>, JsonDocumentOptions)
解析表示單一 JSON 值的 UTF8 編碼文字。JsonElement
public static System.Text.Json.JsonElement Parse(ReadOnlySpan<byte> utf8Json, System.Text.Json.JsonDocumentOptions options = default);
static member Parse : ReadOnlySpan<byte> * System.Text.Json.JsonDocumentOptions -> System.Text.Json.JsonElement
Public Shared Function Parse (utf8Json As ReadOnlySpan(Of Byte), Optional options As JsonDocumentOptions = Nothing) As JsonElement
參數
- utf8Json
- ReadOnlySpan<Byte>
要解析的 JSON 文字。
- options
- JsonDocumentOptions
在解析過程中控制讀取器行為的選項。
傳回
JSON 值的 JsonElement 表示。
例外狀況
utf8Json 不代表有效的單一 JSON 值。
options 包含不支援的選項。
適用於
Parse(ReadOnlySpan<Char>, JsonDocumentOptions)
將代表單一 JSON 值的文字解析成 JsonElement。
public static System.Text.Json.JsonElement Parse(ReadOnlySpan<char> json, System.Text.Json.JsonDocumentOptions options = default);
static member Parse : ReadOnlySpan<char> * System.Text.Json.JsonDocumentOptions -> System.Text.Json.JsonElement
Public Shared Function Parse (json As ReadOnlySpan(Of Char), Optional options As JsonDocumentOptions = Nothing) As JsonElement
參數
- json
- ReadOnlySpan<Char>
要解析的 JSON 文字。
- options
- JsonDocumentOptions
在解析過程中控制讀取器行為的選項。
傳回
JSON 值的 JsonElement 表示。
例外狀況
json 不代表有效的單一 JSON 值。
options 包含不支援的選項。