Skip to content

JsonElement.GetUtf8String Method

Definition

Namespace: Corvus.Text.Json
Assembly: Corvus.Text.Json.dll
Source: JsonElement.cs

GetUtf8String()

Gets the value of the element as a UnescapedUtf8JsonString.

public UnescapedUtf8JsonString GetUtf8String()

Returns

UnescapedUtf8JsonString

The value of the element as an UnescapedUtf8JsonString.

Exceptions

Exception Description
InvalidOperationException This value's ValueKind is neither String nor Null.
ObjectDisposedException The parent JsonDocument has been disposed.

Remarks

The UnescapedUtf8JsonString should be disposed when it is finished with, as it may have rented storage to provide the unescaped value. It is only valid for as long as the source JsonElement is valid.

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