Microsoft.AspNetCore.JsonPatch 10.0.15

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/aspnet/AspNetCore/tree/4d0b3722384bfec7d4c210674df9b7bf1e59da90
122
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/c83354d42e63d2bb07e6b24b7c67ef91e434f359
115
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
107
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/718171eeb4bd236ab4f0d9b1ecd97ecc63ec0be1
97
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
91
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
71
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/ab1f1c636afa3a6607f2d67bc387b586596d1d38
58
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/d62be99ba6e73feb46d7b64a6b4ce8610dc9040a
54
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/8e941eb42f819adb116b881195158b3887a70a1c
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/432e6a061f28dda696ba16bc5442328d23b25d93
23
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/8ca3954ca335343ce6dd1d14d8d1c6c3369710b7
23
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
20
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
18
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
18
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/844a82e37cae48af2ab2ee4f39b41283e6bb4f0e
17
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
16
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
16
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
16
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
16
Microsoft.AspNetCore.Mvc.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
16

.NET Framework 4.6.2

.NET 10.0

.NET Standard 2.0

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