Microsoft.AspNetCore.JsonPatch 11.0.0-preview.5.26302.115
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:
- Update your
Program.cswith logic to construct aNewtonsoftJsonPatchInputFormatter:static NewtonsoftJsonPatchInputFormatter GetJsonPatchInputFormatter() { var builder = new ServiceCollection() .AddLogging() .AddMvc() .AddNewtonsoftJson() .Services.BuildServiceProvider(); return builder .GetRequiredService<IOptions<MvcOptions>>() .Value .InputFormatters .OfType<NewtonsoftJsonPatchInputFormatter>() .First(); } - 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:
- Annotate it with the
HttpPatchattribute - Accept a
JsonPatchDocument<TModel> - Call
ApplyToon 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.
This package was built from the source code at https://github.com/aspnet/Mvc/tree/a6199bbfbab05583f987bae322fb04566841aaea
|
174 |
|
Microsoft.AspNetCore.Mvc.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
|
165 |
|
Microsoft.AspNetCore.Mvc.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
|
156 |
|
Microsoft.AspNetCore.Mvc.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
|
153 |
|
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 at:
https://github.com/aspnet/Mvc/tree/b9793f0a1d9a75940c50e31e956d09397a5d1876
|
153 |
|
Microsoft.AspNetCore.Mvc.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
|
152 |
|
Microsoft.AspNetCore.Mvc.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
|
150 |
|
Microsoft.AspNetCore.Mvc.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
|
149 |
|
Microsoft.AspNetCore.Mvc.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
|
148 |
|
Microsoft.AspNetCore.Mvc.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
|
146 |
|
Microsoft.AspNetCore.Mvc.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
|
145 |
|
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 at:
https://github.com/aspnet/Mvc/tree/522006d2c866add522a546aa3b4720577f1cee57
|
143 |
|
Microsoft.AspNetCore.Mvc.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
|
142 |
|
Microsoft.AspNetCore.Mvc.Formatters.Json
ASP.NET Core MVC formatters for JSON input and output and for JSON PATCH input using Json.NET.
|
141 |
|
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 at:
https://github.com/aspnet/Mvc/tree/fb57810f2960730e59db0235207b873c924bc3fd
|
140 |
.NET 11.0
- Newtonsoft.Json (>= 13.0.4)
.NET Framework 4.6.2
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 13.0.4)
.NET Standard 2.0
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 13.0.4)
| Version | Downloads | Last updated |
|---|---|---|
| 11.0.0-preview.5.26302.115 | 4 | 6/10/2026 |
| 11.0.0-preview.4.26230.115 | 10 | 5/12/2026 |
| 11.0.0-preview.3.26207.106 | 14 | 5/3/2026 |
| 11.0.0-preview.2.26159.112 | 14 | 3/12/2026 |
| 11.0.0-preview.1.26104.118 | 21 | 2/12/2026 |
| 10.0.9 | 3 | 6/10/2026 |
| 10.0.8 | 10 | 5/12/2026 |
| 10.0.7 | 12 | 5/3/2026 |
| 10.0.6 | 11 | 5/3/2026 |
| 10.0.5 | 13 | 3/14/2026 |
| 10.0.4 | 14 | 3/12/2026 |
| 10.0.3 | 17 | 2/12/2026 |
| 10.0.2 | 19 | 1/21/2026 |
| 10.0.1 | 30 | 12/10/2025 |
| 10.0.0 | 48 | 11/11/2025 |
| 10.0.0-rc.2.25502.107 | 65 | 10/14/2025 |
| 10.0.0-rc.1.25451.107 | 69 | 9/10/2025 |
| 10.0.0-preview.7.25380.108 | 73 | 8/13/2025 |
| 10.0.0-preview.6.25358.103 | 68 | 7/16/2025 |
| 10.0.0-preview.5.25277.114 | 88 | 6/8/2025 |
| 10.0.0-preview.4.25258.110 | 71 | 5/14/2025 |
| 10.0.0-preview.3.25172.1 | 77 | 4/14/2025 |
| 10.0.0-preview.2.25164.1 | 97 | 3/22/2025 |
| 10.0.0-preview.1.25120.3 | 104 | 2/27/2025 |
| 9.0.17 | 4 | 6/10/2026 |
| 9.0.16 | 10 | 5/12/2026 |
| 9.0.15 | 12 | 5/3/2026 |
| 9.0.14 | 12 | 3/12/2026 |
| 9.0.13 | 17 | 2/12/2026 |
| 9.0.12 | 19 | 1/20/2026 |
| 9.0.11 | 43 | 11/11/2025 |
| 9.0.10 | 70 | 10/15/2025 |
| 9.0.9 | 65 | 9/10/2025 |
| 9.0.8 | 73 | 8/5/2025 |
| 9.0.7 | 68 | 7/11/2025 |
| 9.0.6 | 73 | 6/14/2025 |
| 9.0.5 | 78 | 5/14/2025 |
| 9.0.4 | 86 | 4/11/2025 |
| 9.0.3 | 95 | 3/15/2025 |
| 9.0.2 | 84 | 2/14/2025 |
| 9.0.1 | 104 | 1/19/2025 |
| 9.0.0 | 95 | 11/13/2024 |
| 9.0.0-rc.2.24474.3 | 91 | 10/8/2024 |
| 9.0.0-rc.1.24452.1 | 98 | 9/12/2024 |
| 9.0.0-preview.7.24406.2 | 115 | 8/13/2024 |
| 9.0.0-preview.6.24328.4 | 100 | 7/10/2024 |
| 9.0.0-preview.5.24306.11 | 98 | 6/15/2024 |
| 9.0.0-preview.4.24267.6 | 96 | 5/24/2024 |
| 9.0.0-preview.3.24172.13 | 109 | 4/16/2024 |
| 9.0.0-preview.2.24128.4 | 111 | 3/14/2024 |
| 9.0.0-preview.1.24081.5 | 108 | 2/20/2024 |
| 8.0.28 | 2 | 6/10/2026 |
| 8.0.27 | 9 | 5/12/2026 |
| 8.0.26 | 11 | 5/3/2026 |
| 8.0.25 | 15 | 3/12/2026 |
| 8.0.24 | 18 | 2/12/2026 |
| 8.0.23 | 20 | 1/21/2026 |
| 8.0.22 | 53 | 11/11/2025 |
| 8.0.21 | 57 | 10/15/2025 |
| 8.0.20 | 80 | 9/10/2025 |
| 8.0.19 | 65 | 8/5/2025 |
| 8.0.18 | 67 | 7/11/2025 |
| 8.0.17 | 67 | 6/14/2025 |
| 8.0.16 | 84 | 5/14/2025 |
| 8.0.15 | 87 | 4/11/2025 |
| 8.0.14 | 81 | 3/15/2025 |
| 8.0.13 | 91 | 2/14/2025 |
| 8.0.12 | 92 | 1/19/2025 |
| 8.0.11 | 103 | 11/13/2024 |
| 8.0.10 | 89 | 10/8/2024 |
| 8.0.8 | 100 | 8/13/2024 |
| 8.0.7 | 122 | 7/9/2024 |
| 8.0.6 | 105 | 5/29/2024 |
| 8.0.5 | 104 | 5/17/2024 |
| 8.0.4 | 102 | 4/14/2024 |
| 8.0.3 | 98 | 3/12/2024 |
| 8.0.2 | 109 | 2/19/2024 |
| 8.0.1 | 109 | 2/3/2024 |
| 8.0.0 | 104 | 11/15/2023 |
| 8.0.0-rc.2.23480.2 | 129 | 10/12/2023 |
| 8.0.0-rc.1.23421.29 | 127 | 9/15/2023 |
| 8.0.0-preview.7.23375.9 | 115 | 8/22/2023 |
| 8.0.0-preview.6.23329.11 | 123 | 7/30/2023 |
| 8.0.0-preview.5.23302.2 | 132 | 7/26/2023 |
| 8.0.0-preview.4.23260.4 | 143 | 7/31/2023 |
| 8.0.0-preview.3.23177.8 | 130 | 5/14/2023 |
| 8.0.0-preview.2.23153.2 | 131 | 4/11/2023 |
| 8.0.0-preview.1.23112.2 | 132 | 2/25/2023 |
| 7.0.20 | 112 | 5/29/2024 |
| 7.0.19 | 103 | 5/17/2024 |
| 7.0.18 | 98 | 4/14/2024 |
| 7.0.17 | 107 | 3/12/2024 |
| 7.0.16 | 113 | 2/21/2024 |
| 7.0.15 | 102 | 1/23/2024 |
| 7.0.14 | 113 | 11/15/2023 |
| 7.0.13 | 116 | 10/30/2023 |
| 7.0.12 | 113 | 10/10/2023 |
| 7.0.11 | 114 | 9/16/2023 |
| 7.0.10 | 115 | 8/22/2023 |
| 7.0.9 | 106 | 7/31/2023 |
| 7.0.8 | 107 | 7/12/2023 |
| 7.0.7 | 117 | 7/16/2023 |
| 7.0.5 | 112 | 7/31/2023 |
| 7.0.4 | 101 | 7/31/2023 |
| 7.0.3 | 110 | 2/21/2023 |
| 7.0.2 | 119 | 1/27/2023 |
| 7.0.1 | 125 | 2/23/2023 |
| 7.0.0 | 122 | 12/4/2022 |
| 7.0.0-rc.2.22476.2 | 132 | 11/4/2022 |
| 7.0.0-rc.1.22427.2 | 123 | 9/25/2022 |
| 7.0.0-preview.7.22376.6 | 115 | 10/25/2022 |
| 7.0.0-preview.6.22330.3 | 110 | 11/27/2022 |
| 7.0.0-preview.5.22303.8 | 136 | 6/27/2022 |
| 7.0.0-preview.4.22251.1 | 117 | 6/28/2022 |
| 7.0.0-preview.3.22178.4 | 128 | 3/9/2023 |
| 7.0.0-preview.2.22153.2 | 102 | 9/17/2022 |
| 7.0.0-preview.1.22109.13 | 131 | 11/4/2022 |
| 6.0.36 | 103 | 11/13/2024 |
| 6.0.35 | 91 | 10/8/2024 |
| 6.0.33 | 96 | 8/13/2024 |
| 6.0.32 | 107 | 7/9/2024 |
| 6.0.31 | 109 | 5/29/2024 |
| 6.0.30 | 118 | 5/17/2024 |
| 6.0.29 | 105 | 4/14/2024 |
| 6.0.28 | 118 | 3/12/2024 |
| 6.0.27 | 114 | 2/19/2024 |
| 6.0.26 | 108 | 1/28/2024 |
| 6.0.25 | 118 | 11/15/2023 |
| 6.0.24 | 119 | 10/30/2023 |
| 6.0.23 | 122 | 10/10/2023 |
| 6.0.22 | 121 | 9/16/2023 |
| 6.0.21 | 111 | 8/22/2023 |
| 6.0.20 | 133 | 7/20/2023 |
| 6.0.19 | 121 | 7/31/2023 |
| 6.0.18 | 105 | 7/31/2023 |
| 6.0.16 | 118 | 5/13/2023 |
| 6.0.15 | 105 | 4/5/2023 |
| 6.0.14 | 123 | 2/23/2023 |
| 6.0.13 | 113 | 2/23/2023 |
| 6.0.12 | 119 | 2/23/2023 |
| 6.0.11 | 111 | 11/24/2022 |
| 6.0.10 | 120 | 12/4/2022 |
| 6.0.9 | 104 | 5/13/2023 |
| 6.0.8 | 114 | 12/25/2022 |
| 6.0.7 | 138 | 12/22/2022 |
| 6.0.6 | 132 | 6/29/2022 |
| 6.0.5 | 112 | 11/30/2022 |
| 6.0.4 | 127 | 1/5/2023 |
| 6.0.3 | 113 | 11/4/2022 |
| 6.0.2 | 115 | 11/5/2022 |
| 6.0.1 | 123 | 10/14/2022 |
| 6.0.0 | 145 | 7/10/2022 |
| 6.0.0-rc.2.21480.10 | 122 | 1/14/2023 |
| 6.0.0-rc.1.21452.15 | 146 | 12/24/2022 |
| 6.0.0-preview.7.21378.6 | 119 | 6/29/2022 |
| 6.0.0-preview.6.21355.2 | 130 | 2/28/2023 |
| 6.0.0-preview.5.21301.17 | 126 | 11/7/2022 |
| 6.0.0-preview.4.21253.5 | 120 | 10/26/2022 |
| 6.0.0-preview.3.21201.13 | 123 | 6/28/2022 |
| 6.0.0-preview.2.21154.6 | 114 | 9/21/2022 |
| 6.0.0-preview.1.21103.6 | 113 | 9/22/2022 |
| 5.0.17 | 123 | 9/2/2022 |
| 5.0.16 | 112 | 12/21/2022 |
| 5.0.15 | 134 | 8/10/2022 |
| 5.0.14 | 103 | 1/20/2023 |
| 5.0.13 | 108 | 10/21/2022 |
| 5.0.12 | 118 | 5/13/2023 |
| 5.0.11 | 129 | 9/19/2022 |
| 5.0.10 | 103 | 11/30/2022 |
| 5.0.9 | 134 | 1/22/2023 |
| 5.0.8 | 115 | 5/13/2023 |
| 5.0.7 | 125 | 9/21/2022 |
| 5.0.6 | 113 | 9/13/2022 |
| 5.0.5 | 136 | 12/15/2022 |
| 5.0.4 | 120 | 10/3/2022 |
| 5.0.3 | 144 | 10/3/2022 |
| 5.0.2 | 134 | 12/30/2022 |
| 5.0.1 | 118 | 2/21/2023 |
| 5.0.0 | 129 | 2/2/2023 |
| 5.0.0-rc.2.20475.17 | 120 | 10/16/2022 |
| 5.0.0-rc.1.20451.17 | 145 | 10/22/2022 |
| 5.0.0-preview.8.20414.8 | 117 | 10/19/2022 |
| 5.0.0-preview.7.20365.19 | 126 | 2/28/2023 |
| 5.0.0-preview.6.20312.15 | 124 | 8/18/2022 |
| 5.0.0-preview.5.20279.2 | 118 | 3/24/2023 |
| 5.0.0-preview.4.20257.10 | 133 | 10/10/2022 |
| 5.0.0-preview.3.20215.14 | 134 | 11/24/2022 |
| 5.0.0-preview.2.20167.3 | 129 | 10/14/2022 |
| 5.0.0-preview.1.20124.5 | 120 | 4/9/2023 |
| 3.1.32 | 132 | 2/23/2023 |
| 3.1.31 | 117 | 12/4/2022 |
| 3.1.30 | 122 | 12/4/2022 |
| 3.1.29 | 115 | 5/13/2023 |
| 3.1.28 | 136 | 9/8/2022 |
| 3.1.27 | 118 | 11/14/2022 |
| 3.1.26 | 105 | 5/17/2023 |
| 3.1.25 | 143 | 8/25/2022 |
| 3.1.24 | 117 | 6/27/2022 |
| 3.1.23 | 115 | 10/6/2022 |
| 3.1.22 | 120 | 11/7/2022 |
| 3.1.21 | 126 | 6/28/2022 |
| 3.1.20 | 106 | 5/17/2023 |
| 3.1.19 | 139 | 9/5/2022 |
| 3.1.18 | 110 | 2/7/2023 |
| 3.1.17 | 121 | 8/29/2022 |
| 3.1.16 | 119 | 9/26/2022 |
| 3.1.15 | 109 | 12/18/2022 |
| 3.1.14 | 112 | 9/26/2022 |
| 3.1.13 | 107 | 9/3/2022 |
| 3.1.12 | 118 | 6/30/2022 |
| 3.1.11 | 130 | 2/11/2023 |
| 3.1.10 | 136 | 10/15/2022 |
| 3.1.9 | 117 | 6/29/2022 |
| 3.1.8 | 106 | 9/20/2022 |
| 3.1.7 | 121 | 5/13/2023 |
| 3.1.6 | 116 | 8/9/2022 |
| 3.1.5 | 114 | 12/21/2022 |
| 3.1.4 | 127 | 6/30/2022 |
| 3.1.3 | 96 | 9/18/2022 |
| 3.1.2 | 111 | 9/5/2022 |
| 3.1.1 | 110 | 12/2/2022 |
| 3.1.0 | 127 | 9/26/2022 |
| 3.1.0-preview3.19555.2 | 132 | 3/2/2023 |
| 3.1.0-preview2.19528.8 | 124 | 9/13/2022 |
| 3.1.0-preview1.19508.20 | 115 | 3/19/2023 |
| 3.0.3 | 131 | 6/28/2022 |
| 3.0.2 | 126 | 5/17/2023 |
| 3.0.0 | 143 | 9/3/2022 |
| 3.0.0-rc1.19457.4 | 103 | 9/18/2022 |
| 3.0.0-preview9.19424.4 | 125 | 11/15/2022 |
| 3.0.0-preview8.19405.7 | 127 | 9/7/2022 |
| 3.0.0-preview7.19365.7 | 115 | 9/10/2022 |
| 3.0.0-preview6.19307.2 | 113 | 10/7/2022 |
| 3.0.0-preview5-19227-01 | 129 | 9/9/2022 |
| 3.0.0-preview4-19216-03 | 112 | 8/25/2022 |
| 3.0.0-preview3-19153-02 | 135 | 6/30/2022 |
| 3.0.0-preview-19075-0444 | 128 | 10/10/2022 |
| 3.0.0-preview-18579-0056 | 125 | 10/27/2022 |
| 2.3.11 | 5 | 6/10/2026 |
| 2.3.10 | 9 | 5/12/2026 |
| 2.3.9 | 23 | 1/10/2026 |
| 2.3.8 | 21 | 1/7/2026 |
| 2.3.0 | 90 | 1/19/2025 |
| 2.2.0 | 125 | 9/16/2022 |
| 2.2.0-preview3-35497 | 129 | 9/8/2022 |
| 2.2.0-preview2-35157 | 102 | 1/25/2023 |
| 2.2.0-preview1-35029 | 133 | 10/4/2022 |
| 2.1.1 | 108 | 5/16/2023 |
| 2.1.0 | 120 | 11/14/2022 |
| 2.1.0-rc1-final | 109 | 9/27/2022 |
| 2.1.0-preview2-final | 123 | 10/8/2022 |
| 2.1.0-preview1-final | 112 | 9/21/2022 |
| 2.0.0 | 129 | 10/1/2022 |
| 2.0.0-preview2-final | 140 | 9/30/2022 |
| 2.0.0-preview1-final | 144 | 10/17/2022 |
| 1.1.2 | 136 | 12/15/2022 |
| 1.1.1 | 157 | 6/30/2022 |
| 1.1.0 | 108 | 9/28/2022 |
| 1.1.0-preview1-final | 127 | 1/27/2023 |
| 1.0.0 | 130 | 10/3/2022 |
| 1.0.0-rc2-final | 122 | 10/4/2022 |