Utf8JsonWriter.WriteBoolean Method

Definition

Overloads

WriteBoolean(String, Boolean)

Writes a property name specified as a string and a Boolean value (as a JSON literal true or false) as part of a name/value pair of a JSON object.

WriteBoolean(ReadOnlySpan<Byte>, Boolean)

Writes a property name specified as a read-only span of bytes and a Boolean value (as a JSON literal true or false) as part of a name/value pair of a JSON object.

WriteBoolean(ReadOnlySpan<Char>, Boolean)

Writes a property name specified as a read-only character span and a Boolean value (as a JSON literal true or false) as part of a name/value pair of a JSON object.

WriteBoolean(JsonEncodedText, Boolean)

Writes the pre-encoded property name and Boolean value (as a JSON literal true or false) as part of a name/value pair of a JSON object.

WriteBoolean(String, Boolean)

Source:
Utf8JsonWriter.WriteProperties.Literal.cs
Source:
Utf8JsonWriter.WriteProperties.Literal.cs
Source:
Utf8JsonWriter.WriteProperties.Literal.cs
Source:
Utf8JsonWriter.WriteProperties.Literal.cs
Source:
Utf8JsonWriter.WriteProperties.Literal.cs

Writes a property name specified as a string and a Boolean value (as a JSON literal true or false) as part of a name/value pair of a JSON object.

public void WriteBoolean (string propertyName, bool value);

Parameters

propertyName
String

The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Boolean

The value to be written as a JSON literal true or false as part of the name/value pair.

Exceptions

The specified property name is too large.

Validation is enabled, and the operation would result in writing invalid JSON.

The propertyName parameter is null.

Remarks

The property name is escaped before writing.

Applies to

.NET 9 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

WriteBoolean(ReadOnlySpan<Byte>, Boolean)

Source:
Utf8JsonWriter.WriteProperties.Literal.cs
Source:
Utf8JsonWriter.WriteProperties.Literal.cs
Source:
Utf8JsonWriter.WriteProperties.Literal.cs
Source:
Utf8JsonWriter.WriteProperties.Literal.cs
Source:
Utf8JsonWriter.WriteProperties.Literal.cs

Writes a property name specified as a read-only span of bytes and a Boolean value (as a JSON literal true or false) as part of a name/value pair of a JSON object.

public void WriteBoolean (ReadOnlySpan<byte> utf8PropertyName, bool value);

Parameters

utf8PropertyName
ReadOnlySpan<Byte>

The UTF-8 encoded property name of the JSON object to be written.

value
Boolean

The value to be written as a JSON literal true or false as part of the name/value pair.

Exceptions

The specified property name is too large.

Validation is enabled, and the operation would result in writing invalid JSON.

Remarks

The property name is escaped before writing.

Applies to

.NET 9 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

WriteBoolean(ReadOnlySpan<Char>, Boolean)

Source:
Utf8JsonWriter.WriteProperties.Literal.cs
Source:
Utf8JsonWriter.WriteProperties.Literal.cs
Source:
Utf8JsonWriter.WriteProperties.Literal.cs
Source:
Utf8JsonWriter.WriteProperties.Literal.cs
Source:
Utf8JsonWriter.WriteProperties.Literal.cs

Writes a property name specified as a read-only character span and a Boolean value (as a JSON literal true or false) as part of a name/value pair of a JSON object.

public void WriteBoolean (ReadOnlySpan<char> propertyName, bool value);

Parameters

propertyName
ReadOnlySpan<Char>

The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Boolean

The value to be written as a JSON literal true or false as part of the name/value pair.

Exceptions

The specified property name is too large.

Validation is enabled, and the operation would result in writing invalid JSON.

Remarks

The property name is escaped before writing.

Applies to

.NET 9 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

WriteBoolean(JsonEncodedText, Boolean)

Source:
Utf8JsonWriter.WriteProperties.Literal.cs
Source:
Utf8JsonWriter.WriteProperties.Literal.cs
Source:
Utf8JsonWriter.WriteProperties.Literal.cs
Source:
Utf8JsonWriter.WriteProperties.Literal.cs
Source:
Utf8JsonWriter.WriteProperties.Literal.cs

Writes the pre-encoded property name and Boolean value (as a JSON literal true or false) as part of a name/value pair of a JSON object.

public void WriteBoolean (System.Text.Json.JsonEncodedText propertyName, bool value);

Parameters

propertyName
JsonEncodedText

The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.

value
Boolean

The value to be written as a JSON literal true or false as part of the name/value pair.

Exceptions

Validation is enabled, and this method would result in writing invalid JSON.

Remarks

The property name should already be escaped when the instance of JsonEncodedText was created.

Applies to

.NET 9 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)