HumanReadableTextWriter Class

Writes human-readable text output with support for indentation, arrays, and objects.

public sealed class HumanReadableTextWriter

Constructors

NameDescription
HumanReadableTextWriter(HumanReadableSerializerOptions)Initializes a new instance of the HumanReadableTextWriter class.

HumanReadableTextWriter(HumanReadableSerializerOptions)

HumanReadableTextWriter.cs

Initializes a new instance of the HumanReadableTextWriter class.

public HumanReadableTextWriter(HumanReadableSerializerOptions options)

Parameters

options HumanReadableSerializerOptions
The serialization options.

Methods

NameDescription
EndArray()Ends writing an array.
EndArrayItem()Ends writing an array item.
EndObject()Ends writing an object.
StartArray()Starts writing an array.
StartArrayItem(string?)Starts writing an array item.
StartObject()Starts writing an object.
ToString()
WriteEmptyArray()Writes an empty array to the output.
WriteEmptyObject()Writes an empty object to the output.
WriteFormattedValue(string, string)Writes a formatted value to the output using the formatter for the specified media type.
WriteNullValue()Writes a null value to the output.
WritePropertyName(string)Writes a property name to the output.
WriteValue(ReadOnlySpan<char>)Writes a value to the output.
WriteValue(string)Writes a value to the output.

Ends writing an array.

public void EndArray()

Ends writing an array item.

public void EndArrayItem()

Ends writing an object.

public void EndObject()

Starts writing an array.

public void StartArray()

StartArrayItem(string?)

HumanReadableTextWriter.cs

Starts writing an array item.

public void StartArrayItem(string? index = null)

Parameters

index string?
An optional index or label for the array item.

Starts writing an object.

public void StartObject()
public override string ToString()

Returns

string

No documentation is available.

Writes an empty array to the output.

public void WriteEmptyArray()

WriteEmptyObject()

HumanReadableTextWriter.cs

Writes an empty object to the output.

public void WriteEmptyObject()

WriteFormattedValue(string, string)

HumanReadableTextWriter.cs

Writes a formatted value to the output using the formatter for the specified media type.

public void WriteFormattedValue(string mediaTypeName, string value)

Parameters

mediaTypeName string
The media type name (e.g., "application/json").
value string
The value to write.

Writes a null value to the output.

public void WriteNullValue()

WritePropertyName(string)

HumanReadableTextWriter.cs

Writes a property name to the output.

public void WritePropertyName(string propertyName)

Parameters

propertyName string
The name of the property.

WriteValue overloads

WriteValue(ReadOnlySpan<char>)

HumanReadableTextWriter.cs

Writes a value to the output.

public void WriteValue(ReadOnlySpan<char> value)
Parameters
value ReadOnlySpan<char>
The value to write.

WriteValue(string)

HumanReadableTextWriter.cs

Writes a value to the output.

public void WriteValue(string value)
Parameters
value string
The value to write.