JsonElement.TryParseValue(Utf8JsonReader, Nullable<JsonElement>) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Attempts to parse one JSON value (including objects or arrays) from the provided reader.
public:
static bool TryParseValue(System::Text::Json::Utf8JsonReader % reader, [Runtime::InteropServices::Out] Nullable<System::Text::Json::JsonElement> % element);
public static bool TryParseValue (ref System.Text.Json.Utf8JsonReader reader, out System.Text.Json.JsonElement? element);
static member TryParseValue : Utf8JsonReader * Nullable -> bool
Public Shared Function TryParseValue (ByRef reader As Utf8JsonReader, ByRef element As Nullable(Of JsonElement)) As Boolean
- reader
- Utf8JsonReader
The reader to read.
- element
- Nullable<JsonElement>
Receives the parsed element.
true
if a value was read and parsed into a JsonElement; false
if the reader ran out of data while parsing.
All other situations result in an exception being thrown.
reader
is using unsupported options.
The current reader
token does not start or represent a value.
A value could not be read from the reader.
If the TokenType property of reader
is PropertyName or None, the reader will be advanced by one call to 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 or false
is returned, 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.
Product | Versions |
---|---|
.NET | 6, 7, 8 (package-provided), 8, 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback: