Skip to content

JsonElement.GetBytesFromBase64 Method

Definition

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

GetBytesFromBase64()

Gets the value of the element as bytes.

public byte[] GetBytesFromBase64()

Returns

byte[]

The value decode to bytes.

Exceptions

Exception Description
InvalidOperationException This value's ValueKind is not String.
FormatException The value is not encoded as Base64 text and hence cannot be decoded to bytes.
ObjectDisposedException The parent JsonDocument has been disposed.

Remarks

This method does not create a byte[] representation of values other than Base64 encoded JSON strings.

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