Skip to content

Utf8JsonReader.GetString Method

Definition

Namespace: Corvus.Text.Json
Assembly: Corvus.Text.Json.dll
Source: Utf8JsonReader.TryGet.cs

GetString()

Parses the current JSON token value from the source, unescaped, and transcoded as a String.

public string GetString()

Returns

string

Exceptions

Exception Description
InvalidOperationException Thrown if trying to get the value of the JSON token that is not a string (i.e. other than String, PropertyName or Null). It will also throw when the JSON string contains invalid UTF-8 bytes, or invalid UTF-16 surrogates.

Remarks

Returns null when TokenType is Null.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

Collaborate with us on GitHub

The source for this content can be found on GitHub, where you can also create and review issues and pull requests.

Open an issue