Skip to content

Utf8JsonWriter.WriteStartArray Method

Definition

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

Overloads

Method Description
WriteStartArray() Writes the beginning of a JSON array.
WriteStartArray(JsonEncodedText) Writes the beginning of a JSON array with a pre-encoded property name as the key.
WriteStartArray(ReadOnlySpan<byte>) Writes the beginning of a JSON array with a property name as the key.
WriteStartArray(string) Writes the beginning of a JSON array with a property name as the key.
WriteStartArray(ReadOnlySpan<char>) Writes the beginning of a JSON array with a property name as the key.

WriteStartArray()

Source: Utf8JsonWriter.cs

Writes the beginning of a JSON array.

public void WriteStartArray()

Exceptions

Exception Description
InvalidOperationException Thrown when the depth of the JSON has exceeded the maximum depth of 1000 OR if this would result in invalid JSON being written (while validation is enabled).

Applies To

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

WriteStartArray(JsonEncodedText)

Source: Utf8JsonWriter.cs

Writes the beginning of a JSON array with a pre-encoded property name as the key.

public void WriteStartArray(JsonEncodedText propertyName)

Parameters

Name Type Description
propertyName JsonEncodedText The JSON-encoded name of the property to write.

Exceptions

Exception Description
InvalidOperationException Thrown when the depth of the JSON has exceeded the maximum depth of 1000 OR if this would result in invalid JSON being written (while validation is enabled).

Applies To

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

WriteStartArray(ReadOnlySpan<byte>)

Source: Utf8JsonWriter.cs

Writes the beginning of a JSON array with a property name as the key.

public void WriteStartArray(ReadOnlySpan<byte> utf8PropertyName)

Parameters

Name Type Description
utf8PropertyName ReadOnlySpan<byte> The UTF-8 encoded property name of the JSON array to be written.

Exceptions

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

Remarks

The property name is escaped before writing.

Applies To

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

WriteStartArray(string)

Source: Utf8JsonWriter.cs

Writes the beginning of a JSON array with a property name as the key.

public void WriteStartArray(string propertyName)

Parameters

Name Type Description
propertyName string The name of the property to write.

Exceptions

Exception Description
ArgumentException Thrown when the specified property name is too large.
ArgumentNullException The propertyName parameter is null.
InvalidOperationException Thrown when the depth of the JSON has exceeded the maximum depth of 1000 OR if this would result in invalid JSON being written (while validation is enabled).

Remarks

The property name is escaped before writing.

Applies To

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

WriteStartArray(ReadOnlySpan<char>)

Source: Utf8JsonWriter.cs

Writes the beginning of a JSON array with a property name as the key.

public void WriteStartArray(ReadOnlySpan<char> propertyName)

Parameters

Name Type Description
propertyName ReadOnlySpan<char> The name of the property to write.

Exceptions

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

Remarks

The property name is escaped before writing.

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