Skip to content

Model binding doesn't state the default JSON input formatter #35629

@eshadboltadr

Description

@eshadboltadr

Description

The input formatters section in the page about ASP .NET Core MVC model binding says this:

By default, ASP.NET Core includes JSON based input formatters for handling JSON data.

It doesn't specify exactly what JSON input formatter library it uses. Does it use System.Text.Json.JsonSerializer or Newtonsoft.Json? How can I set a custom default JsonSerializerOptions for MVC model binding?

I think that this doc page should mention that it can be configured with

builder.Services.AddControllers().AddJsonOptions(options =>
{
    options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
    options.JsonSerializerOptions.PropertyNamingPolicy=JsonNamingPolicy.CamelCase;
});

Page URL

https://learn.microsoft.com/en-us/aspnet/core/mvc/models/model-binding?view=aspnetcore-9.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/mvc/models/model-binding.md

Document ID

9c4af557-8d06-4c6c-ad2a-0dd234547563

Platform Id

5bedc93c-9e23-37ef-e090-7258b295f643

Article author

@tdykstra

Metadata

  • ID: e24f48f8-6c4d-ecda-6ce6-a7826d396e99
  • PlatformId: 5bedc93c-9e23-37ef-e090-7258b295f643
  • Service: aspnet-core
  • Sub-service: mvc

Related Issues


Associated WorkItem - 480869

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions