简体   繁体   中英

ASP.NET Core disable json patch

As stated in this article : adding NewtonsoftJson to the application now enables json patch support. I'm wondering how to add NewthonsoftJson without enabling json patch?

JsonPatch support is handled through the NewtonsoftJsonPatchInputFormatter type. If you don't want this to be enabled, remove it from the InputFormatters collection. Here's an example:

services.AddControllers()
    .AddNewtonsoftJson()
    .AddMvcOptions(o => o.InputFormatters.RemoveType<NewtonsoftJsonPatchInputFormatter>());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM