Microsoft.AspNetCore.JsonPatch 10.0.0-rc.1.25451.107

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
KubernetesClient
Client library for the Kubernetes open source container orchestrator.
27
KubernetesClient
Client library for the Kubernetes open source container orchestrator.
29
KubernetesClient
Client library for the Kubernetes open source container orchestrator.
32
KubernetesClient
Client library for the Kubernetes open source container orchestrator.
33
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.
30
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/06b2bc111203f9b9ff0914a7715675a9a66bdac9
28
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/0a715692d8e2536c899faa0bb4f0cec2c2e33e36
30
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/2aa401550574f93402eba13ff9a4827ef01a2f3a
29
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/3eeb12e106b9e913c3a4dec1a7d16da7b74149eb
9,464
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/3f1acb59718cadf111a0a796681e3d3509bb3381
441
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/47576478939fdd59b4400ad135f47938af486ab3
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/54142bcb25544b72fac28b1b061e7788c91c4f49
29
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
27
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/6a6d775f49623bbd742c02f89d373630668547bb
28
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/b8139c5ee58f1708b0e3368a1b241400edd6cbc4
27
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/bb01bbf4433e27289b99001b7de6a582879d1835
32
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
27
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/f050ae044be8bddc002ab88736e4bf78dc822122
27
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/fb4b5a21ebd67b31fff4ddf5c039181da504c932
44

.NET Framework 4.6.2

.NET 10.0

.NET Standard 2.0

Version Downloads Last updated
10.0.0-rc.1.25451.107 3 09/14/2025
10.0.0-preview.7.25380.108 5 08/15/2025
10.0.0-preview.6.25358.103 5 07/18/2025
10.0.0-preview.5.25277.114 8 06/08/2025
10.0.0-preview.4.25258.110 10 05/18/2025
10.0.0-preview.3.25172.1 12 04/17/2025
10.0.0-preview.2.25164.1 15 03/30/2025
10.0.0-preview.1.25120.3 18 02/27/2025
9.0.9 2 09/13/2025
9.0.8 3 08/10/2025
9.0.7 5 07/11/2025
9.0.6 8 06/12/2025
9.0.5 9 05/18/2025
9.0.4 15 04/19/2025
9.0.3 16 03/17/2025
9.0.2 17 02/27/2025
9.0.1 19 01/21/2025
9.0.0 23 11/14/2024
9.0.0-rc.2.24474.3 17 11/15/2024
9.0.0-rc.1.24452.1 18 11/14/2024
9.0.0-preview.7.24406.2 17 12/01/2024
9.0.0-preview.6.24328.4 18 12/11/2024
9.0.0-preview.5.24306.11 19 11/16/2024
9.0.0-preview.4.24267.6 21 05/26/2024
9.0.0-preview.3.24172.13 21 05/26/2024
9.0.0-preview.2.24128.4 23 05/26/2024
9.0.0-preview.1.24081.5 19 05/26/2024
8.0.20 2 09/13/2025
8.0.19 4 08/10/2025
8.0.18 5 07/12/2025
8.0.17 6 06/12/2025
8.0.16 16 05/16/2025
8.0.15 15 04/19/2025
8.0.14 16 03/17/2025
8.0.13 19 02/18/2025
8.0.12 20 01/24/2025
8.0.11 32 11/14/2024
8.0.10 19 11/16/2024
8.0.8 20 11/17/2024
8.0.7 23 11/16/2024
8.0.6 20 11/16/2024
8.0.5 25 05/26/2024
8.0.4 20 05/26/2024
8.0.3 23 05/26/2024
8.0.2 20 05/26/2024
8.0.1 24 02/04/2024
8.0.0 274 12/18/2023
8.0.0-rc.2.23480.2 18 05/26/2024
8.0.0-rc.1.23421.29 22 05/26/2024
8.0.0-preview.7.23375.9 25 05/26/2024
8.0.0-preview.6.23329.11 40 08/08/2023
8.0.0-preview.5.23302.2 23 05/26/2024
8.0.0-preview.4.23260.4 21 05/26/2024
8.0.0-preview.3.23177.8 19 05/26/2024
8.0.0-preview.2.23153.2 18 05/26/2024
8.0.0-preview.1.23112.2 17 05/26/2024
7.0.20 19 11/16/2024
7.0.19 25 05/26/2024
7.0.18 24 05/26/2024
7.0.17 24 05/26/2024
7.0.16 25 05/26/2024
7.0.15 26 05/01/2024
7.0.14 23 02/04/2024
7.0.13 21 05/26/2024
7.0.12 25 05/26/2024
7.0.11 21 05/26/2024
7.0.10 24 05/26/2024
7.0.9 26 05/26/2024
7.0.8 20 05/26/2024
7.0.7 25 05/26/2024
7.0.5 24 06/16/2023
7.0.4 21 05/26/2024
7.0.3 27 07/13/2023
7.0.2 21 05/26/2024
7.0.1 24 05/26/2024
7.0.0 26 05/26/2024
7.0.0-rc.2.22476.2 24 05/26/2024
7.0.0-rc.1.22427.2 19 05/26/2024
7.0.0-preview.7.22376.6 23 05/26/2024
7.0.0-preview.6.22330.3 21 05/26/2024
7.0.0-preview.5.22303.8 19 05/26/2024
7.0.0-preview.4.22251.1 21 05/26/2024
7.0.0-preview.2.22153.2 23 05/26/2024
6.0.36 21 11/19/2024
6.0.35 20 11/17/2024
6.0.33 18 11/17/2024
6.0.32 20 11/17/2024
6.0.31 20 11/17/2024
6.0.30 28 05/26/2024
6.0.29 26 05/26/2024
6.0.28 23 05/26/2024
6.0.27 22 05/26/2024
6.0.26 24 05/26/2024
6.0.25 24 05/26/2024
6.0.24 28 05/26/2024
6.0.23 25 05/26/2024
6.0.22 25 05/26/2024
6.0.21 24 05/26/2024
6.0.20 24 05/26/2024
6.0.19 24 05/26/2024
6.0.18 23 05/26/2024
6.0.16 23 05/26/2024
6.0.15 24 05/26/2024
6.0.14 23 05/26/2024
6.0.13 25 05/26/2024
6.0.12 22 05/26/2024
6.0.11 24 05/26/2024
6.0.10 24 05/26/2024
6.0.9 26 05/03/2024
6.0.7 25 05/26/2024
6.0.6 20 05/26/2024
6.0.5 26 10/28/2022
6.0.0-rc.2.21480.10 20 05/26/2024
6.0.0-rc.1.21452.15 23 11/03/2022
6.0.0-preview.7.21378.6 20 05/26/2024
6.0.0-preview.4.21253.5 22 05/26/2024
6.0.0-preview.3.21201.13 23 05/26/2024
6.0.0-preview.2.21154.6 27 05/26/2024
6.0.0-preview.1.21103.6 21 05/26/2024
5.0.17 26 07/13/2023
5.0.9 25 05/26/2024
5.0.8 25 05/26/2024
5.0.6 23 05/26/2024
5.0.5 22 05/26/2024
5.0.3 25 05/26/2024
5.0.2 27 05/26/2024
5.0.0 25 05/26/2024
5.0.0-rc.1.20451.17 25 05/26/2024
5.0.0-preview.8.20414.8 17 05/26/2024
5.0.0-preview.7.20365.19 24 05/26/2024
5.0.0-preview.6.20312.15 22 05/26/2024
5.0.0-preview.4.20257.10 24 05/26/2024
5.0.0-preview.3.20215.14 20 05/26/2024
3.1.32 9,159 05/11/2023
3.1.31 21 05/26/2024
3.1.29 21 05/26/2024
3.1.28 27 05/26/2024
3.1.27 23 05/26/2024
3.1.26 24 05/26/2024
3.1.25 21 05/26/2024
3.1.23 22 04/30/2024
3.1.19 24 05/26/2024
3.1.18 23 05/26/2024
3.1.8 23 05/26/2024
3.1.6 22 05/26/2024
3.1.1 20 05/26/2024
3.1.0-preview2.19528.8 23 05/26/2024
3.0.0-rc1.19457.4 21 05/26/2024
3.0.0-preview9.19424.4 20 05/26/2024
3.0.0-preview8.19405.7 21 05/26/2024
3.0.0-preview6.19307.2 25 05/26/2024
3.0.0-preview5-19227-01 21 05/26/2024
3.0.0-preview4-19216-03 24 05/26/2024
3.0.0-preview3-19153-02 23 05/26/2024
3.0.0-preview-19075-0444 23 05/26/2024
3.0.0-preview-18579-0056 26 05/26/2024
2.3.0 21 01/20/2025
2.2.0 42 09/08/2023
2.2.0-preview3-35497 24 05/26/2024
2.2.0-preview1-35029 22 05/26/2024
2.1.0 21 05/26/2024
2.1.0-preview1-final 21 05/26/2024
2.0.0 25 06/06/2023
2.0.0-preview2-final 25 05/26/2024
2.0.0-preview1-final 25 05/26/2024
1.1.2 23 05/26/2024
1.1.0-preview1-final 20 05/26/2024
1.0.0-rc2-final 24 05/26/2024