Microsoft.AspNetCore.JsonPatch 11.0.0-preview.2.26159.112

About

Microsoft.AspNetCore.JsonPatch provides ASP.NET Core support for JSON PATCH requests.

How to Use

To use Microsoft.AspNetCore.JsonPatch, follow these steps:

Installation

dotnet add package Microsoft.AspNetCore.JsonPatch
dotnet add package Microsoft.AspNetCore.Mvc.NewtonsoftJson

Configuration

To enable JSON Patch support, call AddNewtonsoftJson in your ASP.NET Core app's Program.cs:

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllers()
    .AddNewtonsoftJson();

Configure when using System.Text.Json

To add support for JSON Patch using Newtonsoft.Json while continuing to use System.Text.Json for other input and output formatters:

  1. Update your Program.cs with logic to construct a NewtonsoftJsonPatchInputFormatter:
    static NewtonsoftJsonPatchInputFormatter GetJsonPatchInputFormatter()
    {
        var builder = new ServiceCollection()
            .AddLogging()
            .AddMvc()
            .AddNewtonsoftJson()
            .Services.BuildServiceProvider();
    
        return builder
            .GetRequiredService<IOptions<MvcOptions>>()
            .Value
            .InputFormatters
            .OfType<NewtonsoftJsonPatchInputFormatter>()
            .First();
    }
    
  2. Configure the input formatter:
    var builder = WebApplication.CreateBuilder(args);
    
    builder.Services.AddControllers(options =>
    {
        options.InputFormatters.Insert(0, GetJsonPatchInputFormatter());
    });
    

Usage

To define an action method for a JSON Patch in an API controller:

  1. Annotate it with the HttpPatch attribute
  2. Accept a JsonPatchDocument<TModel>
  3. Call ApplyTo on the patch document to apply changes

For example:

[HttpPatch]
public IActionResult JsonPatchWithModelState(
    [FromBody] JsonPatchDocument<Customer> patchDoc)
{
    if (patchDoc is not null)
    {
        var customer = CreateCustomer();

        patchDoc.ApplyTo(customer, ModelState);

        if (!ModelState.IsValid)
        {
            return BadRequest(ModelState);
        }

        return new ObjectResult(customer);
    }
    else
    {
        return BadRequest(ModelState);
    }
}

In a real app, the code would retrieve the data from a store such as a database and update the database after applying the patch.

Additional Documentation

For additional documentation and examples, refer to the official documentation on JSON Patch in ASP.NET Core.

Feedback & Contributing

Microsoft.AspNetCore.JsonPatch is released as open-source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Showing the top 20 packages that depend on Microsoft.AspNetCore.JsonPatch.

Packages Downloads
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/617d594f2bf75a8904d3d0e7d68a0bacf8e6763a
13
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/dc5e11abdb05b322f4b74b3afbcfb352fe984b2e
11
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/c75b3f7a2fb9fe21fd96c93c070fdfa88a2fbe97
11
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/331b52b370cd4e7fe2919d4d4cda27412e2ab1cc
11
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/4d0b3722384bfec7d4c210674df9b7bf1e59da90
11
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/3b519aa7d1a1b66e1d329d694f814e1d8228dc8c
11
Microsoft.AspNetCore.Mvc.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
11
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/3c37ef8f5358abb303c05d299f029fca7d867d56
10
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/cf2c5c9c6dca430b97aa96429b84d0da07eb77f1
10
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/277e317dd5cab9859ceea4c8ebae218522c2c173
10
Microsoft.AspNetCore.Mvc.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
10
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/1bf292d47ac2a0ebda07d8a3f00355dd01915ad5
9
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/561deb05ae2d6680206e3d4a6bc75de699585980
9
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/4768f164d522e128f91827810527730f7468fd74
9
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/440dadc05b2bed38e6a726c2492db90e77d43c62
9
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/c49ccc8727c620ce1cb8fb431bb3fe8f2e747236
9
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/25ef4aa38b77974263cb10f6e9cbd10135f17b59
9
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/898c164a1f537a8210a26eaf388bdc92531f6b09
9
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/432e6a061f28dda696ba16bc5442328d23b25d93
8
Microsoft.AspNetCore.Mvc.NewtonsoftJson
ASP.NET Core MVC features that use Newtonsoft.Json. Includes input and output formatters for JSON and JSON PATCH. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/c9e3996173cec136bc2e9f3b4ec45f2a323b1d63
8

.NET Framework 4.6.2

.NET 11.0

.NET Standard 2.0

Version Downloads Last updated
11.0.0-preview.2.26159.112 2 03/12/2026
11.0.0-preview.1.26104.118 4 02/17/2026
10.0.5 1 03/14/2026
10.0.4 2 03/12/2026
10.0.3 3 02/16/2026
10.0.2 3 01/20/2026
10.0.1 1 12/10/2025
10.0.0 1 12/10/2025
10.0.0-rc.2.25502.107 1 01/04/2026
10.0.0-rc.1.25451.107 1 12/10/2025
10.0.0-preview.7.25380.108 1 03/09/2026
10.0.0-preview.6.25358.103 1 01/25/2026
10.0.0-preview.5.25277.114 1 12/11/2025
10.0.0-preview.4.25258.110 3 02/03/2026
10.0.0-preview.3.25172.1 2 01/21/2026
10.0.0-preview.2.25164.1 3 02/11/2026
10.0.0-preview.1.25120.3 1 01/29/2026
9.0.14 2 03/12/2026
9.0.13 4 02/18/2026
9.0.12 3 01/28/2026
9.0.11 3 12/10/2025
9.0.10 2 12/10/2025
9.0.9 1 03/08/2026
9.0.8 4 12/11/2025
9.0.7 3 12/30/2025
9.0.6 5 12/11/2025
9.0.5 3 12/30/2025
9.0.4 5 12/30/2025
9.0.3 5 12/11/2025
9.0.2 6 12/11/2025
9.0.1 3 12/30/2025
9.0.0 2 02/09/2026
9.0.0-rc.2.24474.3 2 12/10/2025
9.0.0-rc.1.24452.1 4 12/10/2025
9.0.0-preview.7.24406.2 4 12/10/2025
9.0.0-preview.6.24328.4 3 12/10/2025
9.0.0-preview.5.24306.11 2 12/10/2025
9.0.0-preview.4.24267.6 3 12/10/2025
9.0.0-preview.3.24172.13 4 12/10/2025
9.0.0-preview.2.24128.4 4 12/10/2025
9.0.0-preview.1.24081.5 2 12/10/2025
8.0.25 2 03/13/2026
8.0.24 4 02/18/2026
8.0.23 4 01/28/2026
8.0.22 4 12/10/2025
8.0.21 3 12/10/2025
8.0.20 1 12/10/2025
8.0.19 2 12/10/2025
8.0.18 2 12/10/2025
8.0.17 3 12/10/2025
8.0.16 3 12/10/2025
8.0.15 2 12/10/2025
8.0.14 3 12/10/2025
8.0.13 3 12/10/2025
8.0.12 1 12/10/2025
8.0.11 2 12/10/2025
8.0.10 5 12/10/2025
8.0.8 3 02/03/2026
8.0.7 3 12/30/2025
8.0.6 2 12/30/2025
8.0.5 3 12/30/2025
8.0.4 3 12/30/2025
8.0.3 3 12/11/2025
8.0.2 4 12/30/2025
8.0.1 4 12/30/2025
8.0.0 3 02/03/2026
8.0.0-rc.2.23480.2 2 12/10/2025
8.0.0-rc.1.23421.29 2 12/10/2025
8.0.0-preview.7.23375.9 3 12/10/2025
8.0.0-preview.6.23329.11 3 12/10/2025
8.0.0-preview.5.23302.2 2 12/10/2025
8.0.0-preview.4.23260.4 2 12/10/2025
8.0.0-preview.3.23177.8 1 12/10/2025
8.0.0-preview.2.23153.2 4 12/10/2025
8.0.0-preview.1.23112.2 2 12/10/2025
7.0.20 3 12/10/2025
7.0.19 2 12/10/2025
7.0.18 4 12/10/2025
7.0.17 4 12/10/2025
7.0.16 4 12/10/2025
7.0.15 3 12/10/2025
7.0.14 3 12/10/2025
7.0.13 3 12/10/2025
7.0.12 1 12/10/2025
7.0.11 3 12/10/2025
7.0.10 4 12/10/2025
7.0.9 7 12/11/2025
7.0.8 4 12/30/2025
7.0.7 2 02/10/2026
7.0.5 6 12/30/2025
7.0.4 4 12/30/2025
7.0.3 3 12/30/2025
7.0.2 3 12/30/2025
7.0.1 3 12/30/2025
7.0.0 1 03/08/2026
7.0.0-rc.2.22476.2 3 12/10/2025
7.0.0-rc.1.22427.2 2 12/10/2025
7.0.0-preview.7.22376.6 3 12/10/2025
7.0.0-preview.6.22330.3 4 12/10/2025
7.0.0-preview.5.22303.8 2 12/10/2025
7.0.0-preview.4.22251.1 3 12/10/2025
7.0.0-preview.3.22178.4 4 12/10/2025
7.0.0-preview.2.22153.2 3 12/10/2025
7.0.0-preview.1.22109.13 4 12/10/2025
6.0.36 1 12/10/2025
6.0.35 3 12/10/2025
6.0.33 1 12/10/2025
6.0.32 3 12/10/2025
6.0.31 3 01/31/2026
6.0.30 2 12/10/2025
6.0.29 3 12/10/2025
6.0.28 2 12/10/2025
6.0.27 3 12/10/2025
6.0.26 2 12/10/2025
6.0.25 3 12/10/2025
6.0.24 3 12/10/2025
6.0.23 1 12/10/2025
6.0.22 2 12/10/2025
6.0.21 4 12/10/2025
6.0.20 3 12/10/2025
6.0.19 4 12/10/2025
6.0.18 2 12/10/2025
6.0.16 3 12/10/2025
6.0.15 3 12/10/2025
6.0.14 4 12/10/2025
6.0.13 3 12/10/2025
6.0.12 2 12/10/2025
6.0.11 3 12/10/2025
6.0.10 3 12/10/2025
6.0.9 5 12/11/2025
6.0.8 3 12/30/2025
6.0.7 2 12/30/2025
6.0.6 3 02/03/2026
6.0.5 4 12/30/2025
6.0.4 3 12/10/2025
6.0.3 3 12/30/2025
6.0.2 2 12/30/2025
6.0.1 4 12/30/2025
6.0.0 1 03/08/2026
6.0.0-rc.2.21480.10 2 12/10/2025
6.0.0-rc.1.21452.15 3 12/10/2025
6.0.0-preview.7.21378.6 2 12/10/2025
6.0.0-preview.6.21355.2 3 12/10/2025
6.0.0-preview.5.21301.17 5 12/10/2025
6.0.0-preview.4.21253.5 6 12/10/2025
6.0.0-preview.3.21201.13 3 12/10/2025
6.0.0-preview.2.21154.6 3 12/10/2025
6.0.0-preview.1.21103.6 2 12/10/2025
5.0.17 3 12/10/2025
5.0.16 4 12/10/2025
5.0.15 4 12/10/2025
5.0.14 2 12/10/2025
5.0.13 4 12/10/2025
5.0.12 3 12/10/2025
5.0.11 3 12/10/2025
5.0.10 4 12/10/2025
5.0.9 4 12/30/2025
5.0.8 5 12/30/2025
5.0.7 4 12/30/2025
5.0.6 2 12/30/2025
5.0.5 2 02/23/2026
5.0.4 2 12/30/2025
5.0.3 4 12/30/2025
5.0.2 5 12/30/2025
5.0.1 3 12/30/2025
5.0.0 2 02/06/2026
5.0.0-rc.2.20475.17 2 12/10/2025
5.0.0-rc.1.20451.17 4 12/10/2025
5.0.0-preview.8.20414.8 3 12/10/2025
5.0.0-preview.7.20365.19 3 12/10/2025
5.0.0-preview.6.20312.15 2 12/10/2025
5.0.0-preview.5.20279.2 3 12/10/2025
5.0.0-preview.4.20257.10 1 12/10/2025
5.0.0-preview.3.20215.14 3 12/10/2025
5.0.0-preview.2.20167.3 2 12/10/2025
5.0.0-preview.1.20124.5 4 12/10/2025
3.1.32 2 12/10/2025
3.1.31 3 12/10/2025
3.1.30 6 12/10/2025
3.1.29 2 12/10/2025
3.1.28 2 12/10/2025
3.1.27 2 12/10/2025
3.1.26 2 12/10/2025
3.1.25 2 12/10/2025
3.1.24 3 12/10/2025
3.1.23 2 12/10/2025
3.1.22 2 12/10/2025
3.1.21 1 12/10/2025
3.1.20 3 12/10/2025
3.1.19 2 12/10/2025
3.1.18 4 12/10/2025
3.1.17 3 12/10/2025
3.1.16 2 12/10/2025
3.1.15 4 12/10/2025
3.1.14 2 12/10/2025
3.1.13 4 12/10/2025
3.1.12 3 12/10/2025
3.1.11 2 12/10/2025
3.1.10 2 12/10/2025
3.1.9 3 12/30/2025
3.1.8 4 12/30/2025
3.1.7 4 12/30/2025
3.1.6 3 12/30/2025
3.1.5 3 12/30/2025
3.1.4 3 12/30/2025
3.1.3 4 12/26/2025
3.1.2 4 12/30/2025
3.1.1 5 12/26/2025
3.1.0 3 12/30/2025
3.1.0-preview3.19555.2 2 12/10/2025
3.1.0-preview2.19528.8 3 12/10/2025
3.1.0-preview1.19508.20 4 01/28/2026
3.0.3 5 12/26/2025
3.0.2 3 12/30/2025
3.0.0 4 12/10/2025
3.0.0-rc1.19457.4 3 12/11/2025
3.0.0-preview9.19424.4 4 02/04/2026
3.0.0-preview8.19405.7 3 02/02/2026
3.0.0-preview7.19365.7 3 01/21/2026
3.0.0-preview6.19307.2 2 02/02/2026
3.0.0-preview5-19227-01 4 01/29/2026
3.0.0-preview4-19216-03 2 02/05/2026
3.0.0-preview3-19153-02 4 01/29/2026
3.0.0-preview-19075-0444 2 12/11/2025
3.0.0-preview-18579-0056 2 12/11/2025
2.3.9 3 01/28/2026
2.3.8 2 01/29/2026
2.3.0 3 12/30/2025
2.2.0 3 01/26/2026
2.2.0-preview3-35497 3 02/02/2026
2.2.0-preview2-35157 2 02/18/2026
2.2.0-preview1-35029 4 02/02/2026
2.1.1 4 02/02/2026
2.1.0 2 12/30/2025
2.1.0-rc1-final 2 01/04/2026
2.1.0-preview2-final 3 01/29/2026
2.1.0-preview1-final 2 01/29/2026
2.0.0 2 02/03/2026
2.0.0-preview2-final 5 01/21/2026
2.0.0-preview1-final 3 02/02/2026
1.1.2 2 02/06/2026
1.1.1 2 12/26/2025
1.1.0 3 01/22/2026
1.1.0-preview1-final 4 02/02/2026
1.0.0 1 03/09/2026
1.0.0-rc2-final 3 01/04/2026