Microsoft.AspNetCore.JsonPatch 10.0.11

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.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
48
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/36be7ed6d6d56b7da0a2891e3de7ecc2aa48eecd
48
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/d634f2bd1ad6e319f26ff0f1d7ada5539158a19f
47
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/dotnet/tree/75972a5ba730bdaf7cf3a34f528ab0f5c7f05183
47
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/67acc3d331454956fc06d6de2218a625e3e596f8
46
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/417d650029c720dbd2138bcafbb78e2e4ff31bff
46
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/64ea4108e7dcf1ca575f8dd2028363b0b1ef6ebc
45
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/509f6badec2f3162f0e50330cd9107e5624b379b
45
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/68bb6fb08f8f85bb3cf08953a0d2f4a254eaccff
45
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/cec88a329584349fda070f4c7346b10538210ace
45
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/dotnet/tree/fad253f51b461736dfd3cd9c15977bb7493becef
44
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
44
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/d47e49e9c1e173ac90821f7e89cc38e710274241
44
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/954f61dd38b33caa2b736c73530bd5a294174437
44
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/63d1187a01b82719c2891cecc74ee3d51ce892a8
44
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/d4eca39c3fc1944b2c6431bf6b22036bdb176c0d
43
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/c911002ab43b7b989ed67090f2a48d9073d5118d
43
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
43
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/39e0501ee91dcf2b9b885d647795184815fb0408
42
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/57512b49997283599b00a6b67d0ccebaec171daf
42

.NET Framework 4.6.2

.NET 10.0

.NET Standard 2.0

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