Microsoft.AspNetCore.JsonPatch
10.0.0-preview.5.25277.114
Prefix Reserved
See the version list below for details.
dotnet add package Microsoft.AspNetCore.JsonPatch --version 10.0.0-preview.5.25277.114
NuGet\Install-Package Microsoft.AspNetCore.JsonPatch -Version 10.0.0-preview.5.25277.114
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="10.0.0-preview.5.25277.114" />
<PackageVersion Include="Microsoft.AspNetCore.JsonPatch" Version="10.0.0-preview.5.25277.114" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" />
paket add Microsoft.AspNetCore.JsonPatch --version 10.0.0-preview.5.25277.114
#r "nuget: Microsoft.AspNetCore.JsonPatch, 10.0.0-preview.5.25277.114"
#addin nuget:?package=Microsoft.AspNetCore.JsonPatch&version=10.0.0-preview.5.25277.114&prerelease
#tool nuget:?package=Microsoft.AspNetCore.JsonPatch&version=10.0.0-preview.5.25277.114&prerelease
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.cs
with 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
HttpPatch
attribute - Accept a
JsonPatchDocument<TModel>
- 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 | Versions 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. |
-
.NETFramework 4.6.2
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 13.0.3)
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 13.0.3)
-
net10.0
- Newtonsoft.Json (>= 13.0.3)
GitHub repositories (43)
Showing the top 20 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
|
|
thepirat000/Audit.NET
An extensible framework to audit executing operations in .NET and .NET Core.
|
|
asynkron/protoactor-dotnet
Proto Actor - Ultra fast distributed actors for Go, C# and Java/Kotlin
|
|
emberstack/kubernetes-reflector
Custom Kubernetes controller that can be used to replicate secrets, configmaps and certificates.
|
|
grandnode/grandnode2
E-commerce platform built with ASP.NET Core using MongoDB for NoSQL storage
|
|
security-code-scan/security-code-scan
Vulnerability Patterns Detector for C# and VB.NET
|
|
CodeMazeBlog/CodeMazeGuides
The main repository for all the Code Maze guides
|
|
OData/WebApi
OData Web API: A server library built upon ODataLib and WebApi
|
|
laochiangx/ABP-ASP.NET-Boilerplate-Project-CMS
ABP module-zero +AdminLTE+Bootstrap Table+jQuery+Redis + sql server+quartz+hangfire权限管理系统
|
|
Dotnet-Boxed/Framework
.NET Core Extensions and Helper NuGet packages.
|
|
JonPSmith/EfCore.GenericServices
A library to help you quickly code CRUD accesses for a web/mobile/desktop application using EF Core.
|
|
cmu-sei/GHOSTS
GHOSTS is a realistic user simulation framework for cyber experimentation, simulation, training, and exercise
|
|
TeslaFly01/SmartSqlT
🔥🔥🔥 SmartSQL 是一款方便、快捷的数据库文档查询、导出工具!该工具从最初支持CHM文档格式开始,通过不断地探索开发、集思广益和不断改进,又陆续支持Word、Excel、PDF、Html、Xml、Json、MarkDown等文档格式的导出。同时支持SqlServer、MySql、PostgreSQL、SQLite等多种数据库的文档查询和导出功能。
|
|
mattfrear/Swashbuckle.AspNetCore.Filters
A bunch of useful filters for Swashbuckle.AspNetCore
|
|
mKenfenheuer/steam-deck-windows-usermode-driver
A windows usermode controller driver for the steam deck internal controller.
|
|
itlibrium/DDD-starter-dotnet
Sample implementation and comparison of various approaches to building DDD applications. Useful as a baseline to quickly start a DDD dot net project.
|
|
VeritasSoftware/AspNetCore.ApiGateway
Framework for an API Gateway endorsed by the .NET Foundation as revolutionary!
|
|
Librum-Reader/Librum-Server
The Librum server
|
|
solenovex/ASP.NET-Core-3.x-REST-API-Tutorial-Code
|
Version | Downloads | Last updated |
---|---|---|
10.0.0-preview.5.25280.105 | 0 | 6/2/2025 |
10.0.0-preview.5.25277.114 | 0 | 6/3/2025 |
10.0.0-preview.5.25277.101 | 0 | 5/29/2025 |
10.0.0-preview.5.25266.103 | 0 | 5/20/2025 |
10.0.0-preview.4.25255.103 | 0 | 5/12/2025 |
3.0.0-preview-19075-0444 | 2 | 1/28/2019 |
3.0.0-preview-18579-0056 | 2 | 11/30/2018 |
3.0.0-preview-18579-0053 | 2 | 11/30/2018 |