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.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/fc93e595ceffbb1e3e85532bf454e92a6a80dd6b
84
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
79
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/55738ff96b832439076e25584cfe0eb3bace9b01
77
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
77
KubernetesClient
Client library for the Kubernetes open source container orchestrator.
75
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/ae2eabad0e49302d0632a7dde917fdc68d960dc4
74
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
74
KubernetesClient
Client library for the Kubernetes open source container orchestrator.
74
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/0bc3c376f0cd14335e8b3afca69596acabeb1f80
72
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
72
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/80fec4e3edea3972e95885f5c0db6ee06072f917
72
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/2924ca229b3d6c91b7c9eded119b31dfd7aa1fef
72
KubernetesClient
Client library for the Kubernetes open source container orchestrator.
72
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/2b7e994b8a304700a09617ffc5052f0d943bbcba
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/aspnet/AspNetCore/tree/b908e913e3befcfe241f3294509e6d9570acc07b
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/f9ae0f5d30be2de3c0de61b5673bd8873231d70a
70
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/25bd01f17d5f01fc78bea5eb5308b2c0d79e2889
70
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/c663adee8e64ba5d379fa0edfb8201984a7df7d0
69
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/c04846dc66cc97f71d83a83a15437828435f5d44
69
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
68

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