Skip to content

JsonWriterOptions

Definition

Namespace: Corvus.Text.Json
Assembly: Corvus.Text.Json.dll
Source: JsonWriterOptions.cs

Provides the ability for the user to define custom behavior when writing JSON using the Utf8JsonWriter. By default, the JSON is written without any indentation or extra white space. Also, the Utf8JsonWriter will throw an exception if the user attempts to write structurally invalid JSON.

public readonly struct JsonWriterOptions

Properties

Property Type Description
Encoder JavaScriptEncoder The encoder to use when escaping strings, or null to use the default encoder.
IndentCharacter char Defines the indentation character used by Utf8JsonWriter when Indented is enabled. De...
Indented bool Defines whether the Utf8JsonWriter should pretty print the JSON which includes: indenting nested JSON tokens, adding new lines, and adding white sp...
IndentSize int Defines the indentation size used by Utf8JsonWriter when Indented is enabled. Default...
MaxDepth int Gets or sets the maximum depth allowed when writing JSON, with the default (i.e. 0) indicating a max depth of 1000.
NewLine string Gets or sets the new line string to use when Indented is true. The default is the value of...
SkipValidation bool Defines whether the Utf8JsonWriter should skip structural validation and allow the user to write invalid JSON, when set to true. If set to false, a...

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