Skip to content

Utf8JsonWriter.WriteRawValue Method

Definition

Namespace: Corvus.Text.Json
Assembly: Corvus.Text.Json.dll

Overloads

Method Description
WriteRawValue(string, bool) Writes the input as JSON content. It is expected that the input content is a single complete JSON value.
WriteRawValue(ReadOnlySpan<char>, bool) Writes the input as JSON content. It is expected that the input content is a single complete JSON value.
WriteRawValue(ReadOnlySpan<byte>, bool) Writes the input as JSON content. It is expected that the input content is a single complete JSON value.
WriteRawValue(ReadOnlySequence<byte>, bool) Writes the input as JSON content. It is expected that the input content is a single complete JSON value.

WriteRawValue(string, bool)

Source: Utf8JsonWriter.WriteValues.Raw.cs

Writes the input as JSON content. It is expected that the input content is a single complete JSON value.

public void WriteRawValue(string json, bool skipInputValidation)

Parameters

Name Type Description
json string The raw JSON content to write.
skipInputValidation bool Whether to validate if the input is an RFC 8259-compliant JSON payload. (optional)

Exceptions

Exception Description
ArgumentNullException Thrown if json is null.
ArgumentException Thrown if the length of the input is zero or greater than 715,827,882 (MaxValue / 3).
JsonException Thrown if skipInputValidation is false, and the input is not a valid, complete, single JSON value according to the JSON RFC (https:// tools.ietf.org/html/rfc8259) or the input JSON exceeds a recursive depth of 64.

Remarks

When writing untrused JSON values, do not set skipInputValidation to true as this can result in invalid JSON being written, and/or the overall payload being written to the writer instance being invalid. When using this method, the input content will be written to the writer destination as-is, unless validation fails (when it is enabled). The SkipValidation value for the writer instance is honored when using this method. The Indented and Encoder values for the writer instance are not applied when using this method.

Applies To

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

WriteRawValue(ReadOnlySpan<char>, bool)

Source: Utf8JsonWriter.WriteValues.Raw.cs

Writes the input as JSON content. It is expected that the input content is a single complete JSON value.

public void WriteRawValue(ReadOnlySpan<char> json, bool skipInputValidation)

Parameters

Name Type Description
json ReadOnlySpan<char> The raw JSON content to write.
skipInputValidation bool Whether to validate if the input is an RFC 8259-compliant JSON payload. (optional)

Exceptions

Exception Description
ArgumentException Thrown if the length of the input is zero or greater than 715,827,882 (MaxValue / 3).
JsonException Thrown if skipInputValidation is false, and the input is not a valid, complete, single JSON value according to the JSON RFC (https:// tools.ietf.org/html/rfc8259) or the input JSON exceeds a recursive depth of 64.

Remarks

When writing untrused JSON values, do not set skipInputValidation to true as this can result in invalid JSON being written, and/or the overall payload being written to the writer instance being invalid. When using this method, the input content will be written to the writer destination as-is, unless validation fails (when it is enabled). The SkipValidation value for the writer instance is honored when using this method. The Indented and Encoder values for the writer instance are not applied when using this method.

Applies To

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

WriteRawValue(ReadOnlySpan<byte>, bool)

Source: Utf8JsonWriter.WriteValues.Raw.cs

Writes the input as JSON content. It is expected that the input content is a single complete JSON value.

public void WriteRawValue(ReadOnlySpan<byte> utf8Json, bool skipInputValidation)

Parameters

Name Type Description
utf8Json ReadOnlySpan<byte> The raw JSON content to write.
skipInputValidation bool Whether to validate if the input is an RFC 8259-compliant JSON payload. (optional)

Exceptions

Exception Description
ArgumentException Thrown if the length of the input is zero or greater than or equal to MaxValue.
JsonException Thrown if skipInputValidation is false, and the input is not a valid, complete, single JSON value according to the JSON RFC (https:// tools.ietf.org/html/rfc8259) or the input JSON exceeds a recursive depth of 64.

Remarks

When writing untrused JSON values, do not set skipInputValidation to true as this can result in invalid JSON being written, and/or the overall payload being written to the writer instance being invalid. When using this method, the input content will be written to the writer destination as-is, unless validation fails (when it is enabled). The SkipValidation value for the writer instance is honored when using this method. The Indented and Encoder values for the writer instance are not applied when using this method.

Applies To

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

WriteRawValue(ReadOnlySequence<byte>, bool)

Source: Utf8JsonWriter.WriteValues.Raw.cs

Writes the input as JSON content. It is expected that the input content is a single complete JSON value.

public void WriteRawValue(ReadOnlySequence<byte> utf8Json, bool skipInputValidation)

Parameters

Name Type Description
utf8Json ReadOnlySequence<byte> The raw JSON content to write.
skipInputValidation bool Whether to validate if the input is an RFC 8259-compliant JSON payload. (optional)

Exceptions

Exception Description
ArgumentException Thrown if the length of the input is zero or equal to MaxValue.
JsonException Thrown if skipInputValidation is false, and the input is not a valid, complete, single JSON value according to the JSON RFC (https:// tools.ietf.org/html/rfc8259) or the input JSON exceeds a recursive depth of 64.

Remarks

When writing untrused JSON values, do not set skipInputValidation to true as this can result in invalid JSON being written, and/or the overall payload being written to the writer instance being invalid. When using this method, the input content will be written to the writer destination as-is, unless validation fails (when it is enabled). The SkipValidation value for the writer instance is honored when using this method. The Indented and Encoder values for the writer instance are not applied when using this method.

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