Microsoft.AspNetCore.JsonPatch 10.0.0-rc.2.25502.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
Microsoft.AspNetCore.Mvc.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
75
Microsoft.AspNetCore.Mvc.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
131
Microsoft.AspNetCore.Mvc.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET. This package was built from the source code at https://github.com/aspnet/Mvc/tree/a6199bbfbab05583f987bae322fb04566841aaea
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/aspnet/AspNetCore/tree/440dadc05b2bed38e6a726c2492db90e77d43c62
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/aspnet/AspNetCore/tree/b908e913e3befcfe241f3294509e6d9570acc07b
40
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/d12868dd7c10ff0433c16b06d3b59d03c40d987a
39
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/2670c128d522473e146ff9f8159bfffdfe694cd9
62
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/371a26f07b23ad77c636332c2dfc0cbd1d8137ba
83
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
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/5a007deadbb2636caff4656333cafc818b6b2ef6
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/7c810658463f35c39c54d5fb8a8dbbfd463bf747
40
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/96103c264e5e8f0485d07018ba27b78cd8227dd2
40
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/b7a2ec8c7ed6b48857af0a69688a73e8c14fe6cb
67
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/b92c9f50f0333ea661785ba849f303cde6a93844
50
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/bc25dd5d39fd057f7cb28acb5ad4d9e925a375de
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/c911002ab43b7b989ed67090f2a48d9073d5118d
76
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
39
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/e56abc45c4f8adc518abfc11a59849d616431e2c
41
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/e882394a7bb38930da748291fe2c2ceaa6a80588
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/febee99db845fd8766a13bdb391a07c3ee90b4ba
43

.NET Framework 4.6.2

.NET 10.0

.NET Standard 2.0

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