Skip to content

JsonEncodedText

Definition

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

Provides a way to transform UTF-8 or UTF-16 encoded text into a form that is suitable for JSON.

public readonly struct JsonEncodedText : IEquatable<JsonEncodedText>

Remarks

This can be used to cache and store known strings used for writing JSON ahead of time by pre-encoding them up front.

Implements

IEquatable<JsonEncodedText>

Properties

Property Type Description
EncodedUtf8Bytes ReadOnlySpan<byte> Returns the UTF-8 encoded representation of the pre-encoded JSON text.
Value string Returns the UTF-16 encoded representation of the pre-encoded JSON text as a String.

Methods

Method Description
Encode static Encodes the string text value as a JSON string.
Equals Determines whether this instance and another specified JsonEncodedText instance have the same value.
GetHashCode() Returns the hash code for this JsonEncodedText.
ToString() Converts the value of this instance to a String.

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