Table of Contents

Struct MessagePackSerializer.JsonOptions

Namespace
Nerdbank.MessagePack
Assembly
Nerdbank.MessagePack.dll

A description of how JSON should be formatted when calling one of the ConvertToJson(ref MessagePackReader, TextWriter, JsonOptions?) overloads.

public record struct MessagePackSerializer.JsonOptions : IEquatable<MessagePackSerializer.JsonOptions>
Implements
Inherited Members

Constructors

JsonOptions()

Initializes a new instance of the MessagePackSerializer.JsonOptions struct.

public JsonOptions()

Properties

Indentation

Gets or sets the string used to indent the JSON (implies newlines are also used).

public string? Indentation { readonly get; set; }

Property Value

string

Remarks

A null value indicates that no indentation should be used.

NewLine

Gets or sets the sequence of characters used to represent a newline.

public string NewLine { readonly get; set; }

Property Value

string

The default is NewLine.

TrailingCommas

Gets or sets a value indicating whether the JSON may use trailing commas (e.g. after the last property or element in an array).

public bool TrailingCommas { readonly get; set; }

Property Value

bool

Remarks

Trailing commas are not allowed in JSON by default, but some parsers may accept them. JSON5 allows trailing commas.

Trailing commas may only be emitted when Indentation is set to a non-null value.