Skip to content

Utf8JsonWriter.WriteRawPropertyName Method

Definition

Namespace: Corvus.Text.Json
Assembly: Corvus.Text.Json.dll
Source: Utf8JsonWriter.WriteProperties.String.cs

WriteRawPropertyName(ReadOnlySpan<byte>)

Writes the property name (as a JSON string) as the first part of a name/value pair of a JSON object. The caller guarantees the property name is already properly escaped for the default encoder.

public void WriteRawPropertyName(ReadOnlySpan<byte> utf8PropertyName)

Parameters

Name Type Description
utf8PropertyName ReadOnlySpan<byte> The pre-escaped UTF-8 encoded property name to write.

Exceptions

Exception Description
ArgumentException Thrown when the specified property name is too large.
InvalidOperationException Thrown if this would result in invalid JSON being written (while validation is enabled).

Remarks

The property name is NOT escaped before writing. The caller must ensure the value has been properly escaped using Default.

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