Table of Contents

Class NerdbankJsonFormatterOptions

Namespace
Nerdbank.Json.AspNetCoreMvcFormatter
Assembly
Nerdbank.Json.AspNetCoreMvcFormatter.dll

Options that control how the Nerdbank.Json MVC formatters are registered.

public sealed class NerdbankJsonFormatterOptions
Inheritance
NerdbankJsonFormatterOptions
Inherited Members

Properties

InsertFirst

Gets or sets a value indicating whether the Nerdbank.Json formatters are inserted at the front of the formatter collections (so they take precedence during content negotiation) rather than appended.

public bool InsertFirst { get; set; }

Property Value

bool

Remarks

The default is true.

ReplaceSystemTextJsonFormatters

Gets or sets a value indicating whether the built-in System.Text.Json input and output formatters should be removed when the Nerdbank.Json formatters are added.

public bool ReplaceSystemTextJsonFormatters { get; set; }

Property Value

bool

Remarks

The default is false: the Nerdbank.Json formatters are added alongside the framework defaults and never silently replace them. Because InsertFirst defaults to true, the Nerdbank.Json formatters still win content negotiation for JSON media types, but the built-in formatters remain available as a fallback (for example for types that other formatters can handle).

Set this to true to fully take over JSON handling and guarantee that only Nerdbank.Json processes application/json and +json payloads.