Microsoft.AspNetCore.JsonPatch 10.0.1

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Microsoft.AspNetCore.JsonPatch --version 10.0.1
                    
NuGet\Install-Package Microsoft.AspNetCore.JsonPatch -Version 10.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="10.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.AspNetCore.JsonPatch" Version="10.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Microsoft.AspNetCore.JsonPatch --version 10.0.1
                    
#r "nuget: Microsoft.AspNetCore.JsonPatch, 10.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Microsoft.AspNetCore.JsonPatch@10.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Microsoft.AspNetCore.JsonPatch&version=10.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Microsoft.AspNetCore.JsonPatch&version=10.0.1
                    
Install as a Cake Tool

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.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (189)

Showing the top 5 NuGet packages that depend on Microsoft.AspNetCore.JsonPatch:

Package 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/dotnet/tree/87bc0b04e21d786669142109a5128c95618b75ed

Microsoft.AspNetCore.Mvc.Formatters.Json

ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.

Microsoft.AspNetCore.App

Provides a default set of APIs for building an ASP.NET Core application. This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download.

Microsoft.AspNetCore.All

Provides a default set of APIs for building an ASP.NET Core application, and also includes API for third-party integrations with ASP.NET Core. This package requires the ASP.NET Core runtime. This runtime is installed by the .NET Core SDK, or can be acquired separately using installers available at https://aka.ms/dotnet-download.

RavenDB.Client

RavenDB Client is the client library for accessing RavenDB

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Microsoft.AspNetCore.JsonPatch:

Repository Stars
aspnet/Mvc
[Archived] ASP.NET Core MVC is a model view controller framework for building dynamic web sites with clean separation of concerns, including the merged MVC, Web API, and Web Pages w/ Razor. Project moved to https://github.com/aspnet/AspNetCore
ravendb/ravendb
ACID Document Database
Version Downloads Last Updated
11.0.0-preview.1.26104.118 45 2/10/2026
10.0.3 24,213 2/10/2026
10.0.2 897,387 1/13/2026
10.0.1 939,664 12/9/2025
10.0.0 1,500,876 11/11/2025
10.0.0-rc.2.25502.107 31,388 10/14/2025
10.0.0-rc.1.25451.107 27,308 9/9/2025
10.0.0-preview.7.25380.108 5,309 8/12/2025
10.0.0-preview.6.25358.103 4,242 7/15/2025
10.0.0-preview.5.25277.114 11,503 6/6/2025
10.0.0-preview.4.25258.110 3,608 5/12/2025
10.0.0-preview.3.25172.1 7,794 4/10/2025
10.0.0-preview.2.25164.1 1,915 3/18/2025
10.0.0-preview.1.25120.3 145,004 2/25/2025
9.0.13 2,375 2/10/2026
9.0.12 140,595 1/13/2026
9.0.11 833,999 11/11/2025
9.0.10 1,544,648 10/14/2025
9.0.9 1,803,411 9/9/2025
9.0.8 1,926,548 8/5/2025
9.0.7 1,348,066 7/8/2025
9.0.6 1,730,315 6/10/2025
9.0.5 1,635,714 5/13/2025
9.0.4 2,187,593 4/8/2025
9.0.3 1,800,912 3/11/2025
9.0.2 1,967,859 2/11/2025
9.0.1 2,136,813 1/14/2025
9.0.0 6,772,485 11/12/2024
9.0.0-rc.2.24474.3 19,595 10/8/2024
9.0.0-rc.1.24452.1 13,853 9/10/2024
9.0.0-preview.7.24406.2 9,758 8/13/2024
9.0.0-preview.6.24328.4 16,637 7/9/2024
9.0.0-preview.5.24306.11 3,783 6/11/2024
9.0.0-preview.4.24267.6 4,296 5/21/2024
9.0.0-preview.3.24172.13 16,165 4/11/2024
9.0.0-preview.2.24128.4 9,113 3/12/2024
9.0.0-preview.1.24081.5 5,782 2/13/2024
8.0.24 7,757 2/10/2026
8.0.23 313,901 1/13/2026
8.0.22 2,088,717 11/11/2025
8.0.21 1,393,241 10/14/2025
8.0.20 1,523,797 9/9/2025
8.0.19 2,641,039 8/4/2025
8.0.18 1,336,339 7/8/2025
8.0.17 2,577,111 6/10/2025
8.0.16 2,104,663 5/13/2025
8.0.15 3,363,431 4/8/2025
8.0.14 2,923,541 3/11/2025
8.0.13 3,155,207 2/11/2025
8.0.12 4,824,528 1/14/2025
8.0.11 11,744,219 11/12/2024
8.0.10 13,403,105 10/8/2024
8.0.8 15,504,310 8/13/2024
8.0.7 11,206,478 7/9/2024
8.0.6 9,942,952 5/28/2024
8.0.5 3,522,102 5/14/2024
8.0.4 9,466,739 4/9/2024
8.0.3 6,787,047 3/12/2024
8.0.2 6,664,756 2/13/2024
8.0.1 10,133,448 1/9/2024
8.0.0 29,993,100 11/14/2023
8.0.0-rc.2.23480.2 67,146 10/10/2023
8.0.0-rc.1.23421.29 39,415 9/12/2023
8.0.0-preview.7.23375.9 21,576 8/8/2023
8.0.0-preview.6.23329.11 19,925 7/11/2023
8.0.0-preview.5.23302.2 12,250 6/13/2023
8.0.0-preview.4.23260.4 285,214 5/16/2023
8.0.0-preview.3.23177.8 32,788 4/11/2023
8.0.0-preview.2.23153.2 21,718 3/14/2023
8.0.0-preview.1.23112.2 17,037 2/21/2023
7.0.20 1,109,331 5/28/2024
7.0.19 168,787 5/14/2024
7.0.18 291,406 4/9/2024
7.0.17 344,283 3/12/2024
7.0.16 416,972 2/13/2024
7.0.15 870,822 1/9/2024
7.0.14 2,112,653 11/14/2023
7.0.13 2,526,601 10/24/2023
7.0.12 1,472,291 10/10/2023
7.0.11 3,446,479 9/12/2023
7.0.10 2,936,209 8/8/2023
7.0.9 2,322,203 7/11/2023
7.0.8 1,905,759 6/22/2023
7.0.7 1,637,080 6/13/2023
7.0.5 6,947,471 4/11/2023
7.0.4 2,815,080 3/14/2023
7.0.3 3,096,309 2/14/2023
7.0.2 3,842,515 1/10/2023
7.0.1 4,390,612 12/13/2022
7.0.0 18,347,016 11/7/2022
7.0.0-rc.2.22476.2 67,609 10/11/2022
7.0.0-rc.1.22427.2 15,713 9/14/2022
7.0.0-preview.7.22376.6 15,124 8/9/2022
7.0.0-preview.6.22330.3 8,130 7/12/2022
7.0.0-preview.5.22303.8 12,061 6/14/2022
7.0.0-preview.4.22251.1 18,451 5/10/2022
7.0.0-preview.3.22178.4 4,286 4/13/2022
7.0.0-preview.2.22153.2 13,618 3/14/2022
7.0.0-preview.1.22109.13 21,590 2/17/2022
6.0.36 1,677,185 11/12/2024
6.0.35 659,335 10/8/2024
6.0.33 2,619,870 8/13/2024
6.0.32 889,062 7/9/2024
6.0.31 886,273 5/28/2024
6.0.30 320,806 5/14/2024
6.0.29 1,185,550 4/9/2024
6.0.28 1,081,125 3/12/2024
6.0.27 3,731,807 2/13/2024
6.0.26 2,158,677 1/9/2024
6.0.25 3,653,289 11/14/2023
6.0.24 2,126,291 10/24/2023
6.0.23 958,252 10/10/2023
6.0.22 1,926,428 9/12/2023
6.0.21 2,591,976 8/8/2023
6.0.20 2,638,865 7/11/2023
6.0.19 1,580,751 6/22/2023
6.0.18 920,948 6/13/2023
6.0.16 6,772,535 4/11/2023
6.0.15 3,345,799 3/14/2023
6.0.14 3,592,082 2/14/2023
6.0.13 6,131,170 1/10/2023
6.0.12 5,287,057 12/13/2022
6.0.11 8,604,649 11/7/2022
6.0.10 11,491,314 10/11/2022
6.0.9 8,439,906 9/13/2022
6.0.8 10,952,540 8/9/2022
6.0.7 8,701,349 7/12/2022
6.0.6 7,239,829 6/14/2022
6.0.5 13,936,132 5/10/2022
6.0.4 8,166,986 4/11/2022
6.0.3 9,144,669 3/8/2022
6.0.2 8,022,719 2/8/2022
6.0.1 18,569,519 12/14/2021
6.0.0 19,582,243 11/8/2021
6.0.0-rc.2.21480.10 81,508 10/12/2021
6.0.0-rc.1.21452.15 24,523,673 9/14/2021
6.0.0-preview.7.21378.6 72,367 8/10/2021
6.0.0-preview.6.21355.2 10,049 7/14/2021
6.0.0-preview.5.21301.17 10,861 6/15/2021
6.0.0-preview.4.21253.5 26,613 5/24/2021
6.0.0-preview.3.21201.13 16,959 4/8/2021
6.0.0-preview.2.21154.6 48,120 3/11/2021 6.0.0-preview.2.21154.6 is deprecated because it is no longer maintained.
6.0.0-preview.1.21103.6 26,054 2/12/2021 6.0.0-preview.1.21103.6 is deprecated because it is no longer maintained.
5.0.17 2,764,913 5/10/2022 5.0.17 is deprecated because it is no longer maintained.
5.0.16 365,686 4/11/2022 5.0.16 is deprecated because it is no longer maintained.
5.0.15 838,778 3/8/2022 5.0.15 is deprecated because it is no longer maintained.
5.0.14 629,703 2/8/2022 5.0.14 is deprecated because it is no longer maintained.
5.0.13 3,182,610 12/14/2021 5.0.13 is deprecated because it is no longer maintained.
5.0.12 2,456,114 11/7/2021 5.0.12 is deprecated because it is no longer maintained.
5.0.11 5,769,431 10/12/2021 5.0.11 is deprecated because it is no longer maintained.
5.0.10 7,660,452 9/14/2021 5.0.10 is deprecated because it is no longer maintained.
5.0.9 4,705,264 8/10/2021 5.0.9 is deprecated because it is no longer maintained.
5.0.8 4,122,070 7/13/2021 5.0.8 is deprecated because it is no longer maintained.
5.0.7 4,786,477 6/8/2021 5.0.7 is deprecated because it is no longer maintained.
5.0.6 3,129,493 5/11/2021 5.0.6 is deprecated because it is no longer maintained.
5.0.5 4,566,032 4/6/2021 5.0.5 is deprecated because it is no longer maintained.
5.0.4 3,504,483 3/9/2021 5.0.4 is deprecated because it is no longer maintained.
5.0.3 3,978,113 2/9/2021 5.0.3 is deprecated because it is no longer maintained.
5.0.2 3,176,527 1/12/2021 5.0.2 is deprecated because it is no longer maintained.
5.0.1 3,175,191 12/8/2020 5.0.1 is deprecated because it is no longer maintained.
5.0.0 15,664,060 11/9/2020 5.0.0 is deprecated because it is no longer maintained.
5.0.0-rc.2.20475.17 35,463 10/13/2020 5.0.0-rc.2.20475.17 is deprecated because it is no longer maintained.
5.0.0-rc.1.20451.17 23,406 9/14/2020 5.0.0-rc.1.20451.17 is deprecated because it is no longer maintained.
5.0.0-preview.8.20414.8 8,671 8/25/2020 5.0.0-preview.8.20414.8 is deprecated because it is no longer maintained.
5.0.0-preview.7.20365.19 19,194 7/21/2020 5.0.0-preview.7.20365.19 is deprecated because it is no longer maintained.
5.0.0-preview.6.20312.15 9,731 6/25/2020 5.0.0-preview.6.20312.15 is deprecated because it is no longer maintained.
5.0.0-preview.5.20279.2 23,037 6/10/2020 5.0.0-preview.5.20279.2 is deprecated because it is no longer maintained.
5.0.0-preview.4.20257.10 6,601 5/18/2020 5.0.0-preview.4.20257.10 is deprecated because it is no longer maintained.
5.0.0-preview.3.20215.14 8,681 4/23/2020 5.0.0-preview.3.20215.14 is deprecated because it is no longer maintained.
5.0.0-preview.2.20167.3 11,125 4/2/2020 5.0.0-preview.2.20167.3 is deprecated because it is no longer maintained.
5.0.0-preview.1.20124.5 5,551 3/16/2020 5.0.0-preview.1.20124.5 is deprecated because it is no longer maintained.
3.1.32 3,045,333 12/13/2022
3.1.31 256,392 11/8/2022
3.1.30 385,927 10/11/2022
3.1.29 457,854 9/13/2022
3.1.28 598,564 8/9/2022
3.1.27 634,073 7/12/2022
3.1.26 478,430 6/14/2022
3.1.25 731,777 5/10/2022
3.1.24 463,621 4/11/2022
3.1.23 901,326 3/8/2022
3.1.22 3,587,653 12/14/2021
3.1.21 1,920,028 11/7/2021
3.1.20 1,455,827 10/11/2021
3.1.19 1,396,197 9/14/2021
3.1.18 2,008,540 8/10/2021
3.1.17 1,976,047 7/13/2021
3.1.16 2,533,101 6/8/2021
3.1.15 2,205,860 5/11/2021
3.1.14 3,150,492 4/6/2021
3.1.13 3,300,159 3/9/2021
3.1.12 3,053,836 2/9/2021
3.1.11 4,186,930 1/12/2021
3.1.10 7,884,877 11/9/2020
3.1.9 8,383,030 10/13/2020
3.1.8 10,400,399 9/8/2020
3.1.7 7,124,076 8/11/2020
3.1.6 8,085,629 7/14/2020
3.1.5 11,158,986 6/9/2020
3.1.4 7,784,136 5/12/2020
3.1.3 14,406,266 3/24/2020
3.1.2 9,984,447 2/18/2020
3.1.1 11,910,111 1/14/2020
3.1.0 10,767,858 12/3/2019
3.1.0-preview3.19555.2 45,601 11/13/2019 3.1.0-preview3.19555.2 is deprecated because it is no longer maintained.
3.1.0-preview2.19528.8 7,531 11/1/2019 3.1.0-preview2.19528.8 is deprecated because it is no longer maintained.
3.1.0-preview1.19508.20 13,650 10/15/2019 3.1.0-preview1.19508.20 is deprecated because it is no longer maintained.
3.0.3 629,052 2/18/2020 3.0.3 is deprecated because it is no longer maintained.
3.0.2 601,770 1/14/2020 3.0.2 is deprecated because it is no longer maintained.
3.0.0 42,345,593 9/23/2019 3.0.0 is deprecated because it is no longer maintained.
3.0.0-rc1.19457.4 42,067 9/16/2019 3.0.0-rc1.19457.4 is deprecated because it is no longer maintained.
3.0.0-preview9.19424.4 83,992 9/4/2019 3.0.0-preview9.19424.4 is deprecated because it is no longer maintained.
3.0.0-preview8.19405.7 118,454 8/13/2019 3.0.0-preview8.19405.7 is deprecated because it is no longer maintained.
3.0.0-preview7.19365.7 100,032 7/23/2019 3.0.0-preview7.19365.7 is deprecated because it is no longer maintained.
3.0.0-preview6.19307.2 285,388 6/12/2019 3.0.0-preview6.19307.2 is deprecated because it is no longer maintained.
3.0.0-preview5-19227-01 866,327 5/6/2019 3.0.0-preview5-19227-01 is deprecated because it is no longer maintained.
3.0.0-preview4-19216-03 39,564 4/18/2019 3.0.0-preview4-19216-03 is deprecated because it is no longer maintained.
3.0.0-preview3-19153-02 6,545,815 3/6/2019 3.0.0-preview3-19153-02 is deprecated because it is no longer maintained.
3.0.0-preview-19075-0444 23,869 1/29/2019 3.0.0-preview-19075-0444 is deprecated because it is no longer maintained.
3.0.0-preview-18579-0056 4,461 12/3/2018 3.0.0-preview-18579-0056 is deprecated because it is no longer maintained.
2.3.9 2,146 1/7/2026
2.3.8 945 1/7/2026
2.3.0 9,807,183 1/14/2025
2.2.0 264,764,743 12/3/2018 2.2.0 is deprecated because it is no longer maintained.
2.2.0-preview3-35497 106,733 10/17/2018 2.2.0-preview3-35497 is deprecated because it is no longer maintained.
2.2.0-preview2-35157 47,057 9/12/2018 2.2.0-preview2-35157 is deprecated because it is no longer maintained.
2.2.0-preview1-35029 29,848 8/22/2018 2.2.0-preview1-35029 is deprecated because it is no longer maintained.
2.1.1 44,421,707 6/18/2018
2.1.0 108,774,730 5/29/2018
2.1.0-rc1-final 123,635 5/6/2018 2.1.0-rc1-final is deprecated because it is no longer maintained.
2.1.0-preview2-final 205,059 4/10/2018 2.1.0-preview2-final is deprecated because it is no longer maintained.
2.1.0-preview1-final 174,528 2/26/2018 2.1.0-preview1-final is deprecated because it is no longer maintained.
2.0.0 86,040,883 8/11/2017 2.0.0 is deprecated because it is no longer maintained.
2.0.0-preview2-final 106,860 6/27/2017 2.0.0-preview2-final is deprecated because it is no longer maintained.
2.0.0-preview1-final 33,162 5/10/2017 2.0.0-preview1-final is deprecated because it is no longer maintained.
1.1.2 9,729,889 5/9/2017 1.1.2 is deprecated because it is no longer maintained.
1.1.1 4,171,491 3/6/2017 1.1.1 is deprecated because it is no longer maintained.
1.1.0 3,325,841 11/16/2016 1.1.0 is deprecated because it is no longer maintained.
1.1.0-preview1-final 31,162 10/24/2016 1.1.0-preview1-final is deprecated because it is no longer maintained.
1.0.0 57,618,172 6/27/2016 1.0.0 is deprecated because it is no longer maintained.
1.0.0-rc2-final 194,134 5/16/2016 1.0.0-rc2-final is deprecated because it is no longer maintained.