Table of Contents

Class JsonFormatterOptions

Namespace
Cuemon.Extensions.Text.Json.Formatters
Assembly
Cuemon.Extensions.Text.Json.dll

Specifies options that is related to JsonFormatter operations.

public class JsonFormatterOptions : IContentNegotiation, IExceptionDescriptorOptions, IValidatableParameterObject, IParameterObject
Inheritance
JsonFormatterOptions
Implements
Extension Methods

Constructors

JsonFormatterOptions()

Initializes a new instance of the JsonFormatterOptions class.

public JsonFormatterOptions()

Remarks

The following table shows the initial property values for an instance of JsonFormatterOptions.

PropertyInitial Value
SettingsJsonSerializerOptions
SensitivityDetailsNone
SupportedMediaTypes
new List<MediaTypeHeaderValue>()
{
new("application/json"),
new("text/json")
};

Properties

DefaultConverters

Gets or sets a delegate that is invoked when JsonFormatterOptions is initialized and propagates registered JsonConverter implementations.

public static Action<IList<JsonConverter>> DefaultConverters { get; set; }

Property Value

Action<IList<JsonConverter>>

The delegate which propagates registered JsonConverter implementations when JsonFormatterOptions is initialized.

DefaultMediaType

Provides the default/fallback media type that the associated formatter should use when content negotiation either fails or is absent.

public static MediaTypeHeaderValue DefaultMediaType { get; }

Property Value

MediaTypeHeaderValue

The media type that the associated formatter should use when content negotiation either fails or is absent.

SensitivityDetails

Gets or sets a bitwise combination of the enumeration values that specify which sensitive details to include in the serialized result.

public FaultSensitivityDetails SensitivityDetails { get; set; }

Property Value

FaultSensitivityDetails

The enumeration values that specify which sensitive details to include in the serialized result.

Settings

Gets or sets the settings to support the JsonFormatter.

public JsonSerializerOptions Settings { get; set; }

Property Value

JsonSerializerOptions

A JsonSerializerOptions instance that specifies a set of features to support the JsonFormatter object.

SupportedMediaTypes

Gets or sets the collection of MediaTypeHeaderValue elements supported by the JsonFormatter.

public IReadOnlyCollection<MediaTypeHeaderValue> SupportedMediaTypes { get; set; }

Property Value

IReadOnlyCollection<MediaTypeHeaderValue>

A collection of MediaTypeHeaderValue elements supported by the JsonFormatter.

Methods

ValidateOptions()

Determines whether the public read-write properties of this instance are in a valid state.

public void ValidateOptions()

Remarks

This method is expected to throw exceptions when one or more conditions fails to be in a valid state.

Exceptions

InvalidOperationException

Settings cannot be null.