dotnet / dotnet/aspnetcore

Define Json serialization settings per controller.

Open
#20,630 13 comments 39 reactions 0 assignees View on GitHub
affected-very-few area-mvc enhancement feature-mvc-formatting severity-minor
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

# Issue Title
Setup Json serialization per controller in the ASPNET Core applicaiton.

# General

Asp net core has a mechanism to define json serialization options per application using:

services
.AddControllers(options => {})
.AddJsonOptions(options => { /* json options */})
;

however there is no way to define json serialization settings per individual controller.
The output json can be controlled by parameter of the Json() method in each action, but there is no way to control how input parameters are deserializing from request body on the action.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.