แก้ไข

แชร์ผ่าน


JsonDocument.ParseValue(Utf8JsonReader) Method

Definition

Parses one JSON value (including objects or arrays) from the provided reader.

public:
 static System::Text::Json::JsonDocument ^ ParseValue(System::Text::Json::Utf8JsonReader % reader);
public static System.Text.Json.JsonDocument ParseValue (ref System.Text.Json.Utf8JsonReader reader);
static member ParseValue : Utf8JsonReader -> System.Text.Json.JsonDocument
Public Shared Function ParseValue (ByRef reader As Utf8JsonReader) As JsonDocument

Parameters

reader
Utf8JsonReader

The reader to read.

Returns

A JsonDocument representing the value (and nested values) read from the reader.

Exceptions

reader contains unsupported options.

-or-

The current reader token does not start or represent a value.

A value could not be read from the reader.

Remarks

If the TokenType property of reader is JsonTokenType.PropertyName or JsonTokenType.None, the reader will advance by one call to Utf8JsonReader.Read() to determine the start of the value.

Upon completion of this method, reader is positioned at the final token in the JSON value. If an exception is thrown, the reader is reset to the state it was in when the method was called.

This method makes a copy of the data the reader acted on, so there is no caller requirement to maintain data integrity beyond the return of this method.

Applies to