編輯

共用方式為


JsonDocument.Parse Method

Definition

Overloads

Parse(ReadOnlySequence<Byte>, JsonDocumentOptions)

Parses a sequence as UTF-8-encoded text representing a single JSON value into a JsonDocument.

Parse(Stream, JsonDocumentOptions)

Parses a Stream as UTF-8-encoded data representing a single JSON value into a JsonDocument. The stream is read to completion.

Parse(ReadOnlyMemory<Byte>, JsonDocumentOptions)

Parses memory as UTF-8-encoded text representing a single JSON value into a JsonDocument.

Parse(ReadOnlyMemory<Char>, JsonDocumentOptions)

Parses text representing a single JSON value into a JsonDocument.

Parse(String, JsonDocumentOptions)

Parses text representing a single JSON string value into a JsonDocument.

Parse(ReadOnlySequence<Byte>, JsonDocumentOptions)

Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs

Parses a sequence as UTF-8-encoded text representing a single JSON value into a JsonDocument.

public static System.Text.Json.JsonDocument Parse (System.Buffers.ReadOnlySequence<byte> utf8Json, System.Text.Json.JsonDocumentOptions options = default);
static member Parse : System.Buffers.ReadOnlySequence<byte> * System.Text.Json.JsonDocumentOptions -> System.Text.Json.JsonDocument
Public Shared Function Parse (utf8Json As ReadOnlySequence(Of Byte), Optional options As JsonDocumentOptions = Nothing) As JsonDocument

Parameters

utf8Json
ReadOnlySequence<Byte>

The JSON text to parse.

options
JsonDocumentOptions

Options to control the reader behavior during parsing.

Returns

A JsonDocument representation of the JSON value.

Exceptions

utf8Json does not represent a valid single JSON value.

options contains unsupported options.

Remarks

The ReadOnlySequence<T> may be used for the entire lifetime of the JsonDocument object, and the caller must ensure that the data therein does not change during the object lifetime. Because the input is considered to be text, a UTF-8 Byte-Order-Mark (BOM) must not be present.

Applies to

Parse(Stream, JsonDocumentOptions)

Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs

Parses a Stream as UTF-8-encoded data representing a single JSON value into a JsonDocument. The stream is read to completion.

public static System.Text.Json.JsonDocument Parse (System.IO.Stream utf8Json, System.Text.Json.JsonDocumentOptions options = default);
static member Parse : System.IO.Stream * System.Text.Json.JsonDocumentOptions -> System.Text.Json.JsonDocument
Public Shared Function Parse (utf8Json As Stream, Optional options As JsonDocumentOptions = Nothing) As JsonDocument

Parameters

utf8Json
Stream

The JSON data to parse.

options
JsonDocumentOptions

Options to control the reader behavior during parsing.

Returns

A JsonDocument representation of the JSON value.

Exceptions

utf8Json does not represent a valid single JSON value.

options contains unsupported options.

Applies to

Parse(ReadOnlyMemory<Byte>, JsonDocumentOptions)

Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs

Parses memory as UTF-8-encoded text representing a single JSON value into a JsonDocument.

public static System.Text.Json.JsonDocument Parse (ReadOnlyMemory<byte> utf8Json, System.Text.Json.JsonDocumentOptions options = default);
static member Parse : ReadOnlyMemory<byte> * System.Text.Json.JsonDocumentOptions -> System.Text.Json.JsonDocument
Public Shared Function Parse (utf8Json As ReadOnlyMemory(Of Byte), Optional options As JsonDocumentOptions = Nothing) As JsonDocument

Parameters

utf8Json
ReadOnlyMemory<Byte>

The JSON text to parse.

options
JsonDocumentOptions

Options to control the reader behavior during parsing.

Returns

A JsonDocument representation of the JSON value.

Exceptions

utf8Json does not represent a valid single JSON value.

options contains unsupported options.

Remarks

The ReadOnlyMemory<T> value will be used for the entire lifetime of the JsonDocument object, and the caller must ensure that the data therein does not change during the object lifetime.

Because the input is considered to be text, a UTF-8 Byte-Order-Mark (BOM) must not be present.

Applies to

Parse(ReadOnlyMemory<Char>, JsonDocumentOptions)

Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs

Parses text representing a single JSON value into a JsonDocument.

public static System.Text.Json.JsonDocument Parse (ReadOnlyMemory<char> json, System.Text.Json.JsonDocumentOptions options = default);
static member Parse : ReadOnlyMemory<char> * System.Text.Json.JsonDocumentOptions -> System.Text.Json.JsonDocument
Public Shared Function Parse (json As ReadOnlyMemory(Of Char), Optional options As JsonDocumentOptions = Nothing) As JsonDocument

Parameters

json
ReadOnlyMemory<Char>

The JSON text to parse.

options
JsonDocumentOptions

Options to control the reader behavior during parsing.

Returns

A JsonDocument representation of the JSON value.

Exceptions

json does not represent a valid single JSON value.

options contains unsupported options.

Remarks

The ReadOnlyMemory<T> value may be used for the entire lifetime of the JsonDocument object, and the caller must ensure that the data therein does not change during the object lifetime.

Applies to

Parse(String, JsonDocumentOptions)

Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs
Source:
JsonDocument.Parse.cs

Parses text representing a single JSON string value into a JsonDocument.

public static System.Text.Json.JsonDocument Parse (string json, System.Text.Json.JsonDocumentOptions options = default);
static member Parse : string * System.Text.Json.JsonDocumentOptions -> System.Text.Json.JsonDocument
Public Shared Function Parse (json As String, Optional options As JsonDocumentOptions = Nothing) As JsonDocument

Parameters

json
String

The JSON text to parse.

options
JsonDocumentOptions

Options to control the reader behavior during parsing.

Returns

A JsonDocument representation of the JSON value.

Exceptions

json does not represent a valid single JSON value.

options contains unsupported options.

Applies to