Table of Contents

AddNewtonsoftJsonExceptionResponseFormatter Method

Definition

AddNewtonsoftJsonExceptionResponseFormatter(IServiceCollection, Action<NewtonsoftJsonFormatterOptions>)

Adds an IHttpExceptionDescriptorResponseFormatter that uses NewtonsoftJsonFormatter as engine of serialization to the specified list of services.

public static IServiceCollection AddNewtonsoftJsonExceptionResponseFormatter(this IServiceCollection services, Action<NewtonsoftJsonFormatterOptions> setup = null)

Parameters

services IServiceCollection

The IServiceCollection to extend.

setup Action<NewtonsoftJsonFormatterOptions>

The NewtonsoftJsonFormatterOptions which may be configured.

Returns

IServiceCollection

A reference to services so that additional calls can be chained.

Remarks

Configuration of the NewtonsoftJsonFormatter is done through a call to GetService<T>(IServiceProvider) retrieving an IOptions<TOptions> implementation of NewtonsoftJsonFormatterOptions.

Exceptions

ArgumentNullException

services cannot be null