![]() |
VOOZH | about |
dotnet add package JsonPatch.Net --version 5.0.2
NuGet\Install-Package JsonPatch.Net -Version 5.0.2
<PackageReference Include="JsonPatch.Net" Version="5.0.2" />
<PackageVersion Include="JsonPatch.Net" Version="5.0.2" />Directory.Packages.props
<PackageReference Include="JsonPatch.Net" />Project file
paket add JsonPatch.Net --version 5.0.2
#r "nuget: JsonPatch.Net, 5.0.2"
#:package JsonPatch.Net@5.0.2
#addin nuget:?package=JsonPatch.Net&version=5.0.2Install as a Cake Addin
#tool nuget:?package=JsonPatch.Net&version=5.0.2Install as a Cake Tool
JsonPatch.Net implements JSON Patch, RFC 6902, a JSON document structure for expressing a sequence of operations to apply to another JSON document.
Deserialize and apply immediately:
var patch = JsonSerializer.Deserialize<JsonPatch>(patchString);
var doc = JsonNode.Parse(docString);
var result = patch.Apply(doc);
Or you can build a patch inline:
var patch = new JsonPatch(PatchOperation.Add("/foo/bar", "baz"),
PatchOperation.Test("/foo/biz", false));
There is also limited patch generation support:
// parse your data
var start = JsonNode.Parse("[{\"test\":\"test123\"},{\"test\":\"test321\"},{\"test\":[1,2,3]},{\"test\":[1,2,4]}]");
// or build it inline
var target = new JsonArray{
new JsonObject { ["test"] = "test123" },
new JsonObject { ["test"] = "test32132" },
new JsonObject { ["test1"] = "test321" },
new JsonObject { ["test"] = new JsonArray{ 1, 2, 3 } },
new JsonObject { ["test"] = new JsonArray{ 1, 2, 3 } },
}
var patch = start.CreatePatch(target);
/*
Result:
[
{"op":"replace","path":"/1/test","value":"test32132"},
{"op":"remove","path":"/2/test"},
{"op":"add","path":"/2/test1","value":"test321"},
{"op":"replace","path":"/3/test/2","value":3},
{"op":"add","path":"/4","value":{"test":[1,2,3]}}
]
*/
If you found this library helpful and would like to promote continued development, please consider sponsoring the maintainers.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on JsonPatch.Net:
| Package | Downloads |
|---|---|
|
Aspire.Hosting
Core abstractions for the Aspire application model. |
|
|
Aspire.Hosting.AppHost
Core library and MSBuild logic for Aspire AppHost projects. |
|
|
Umbraco.Cms
Installs Umbraco CMS with all default dependencies in your ASP.NET Core project. |
|
|
Aspire.Hosting.Azure
Azure resource types for Aspire. |
|
|
Umbraco.Cms.StaticAssets
Contains the static assets needed to run Umbraco CMS. |
Showing the top 8 popular GitHub repositories that depend on JsonPatch.Net:
| Repository | Stars |
|---|---|
|
microsoft/aspire
Aspire is the tool for code-first, extensible, observable dev and deploy.
|
|
|
umbraco/Umbraco-CMS
Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
|
|
|
asynkron/protoactor-dotnet
Proto Actor - Ultra fast distributed actors for Go, C# and Java/Kotlin
|
|
|
kubernetes-client/csharp
Officially supported dotnet Kubernetes Client library
|
|
|
dotnet/dotnet-operator-sdk
KubeOps is a Kubernetes operator sdk in dotnet. Strongly inspired by kubebuilder.
|
|
|
corvus-dotnet/Corvus.JsonSchema
Support for Json Schema validation and entity generation
|
|
|
Altinn/altinn-studio
Next generation open source Altinn platform and applications.
|
|
|
NosCoreIO/NosCore
NosCore is a Nostale emulator in c# (.Net 10) using SuperSocket / Entity Framework / WebAPI / Autofac / Mapster / Serilog
|
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.2 | 300,003 | 3/15/2026 |
| 5.0.1 | 25,410 | 2/25/2026 |
| 5.0.0 | 32,578 | 2/1/2026 |
| 4.0.1 | 168,399 | 12/21/2025 |
| 4.0.0 | 25,836 | 12/9/2025 |
| 3.3.0 | 16,530,093 | 1/2/2025 |
| 3.2.3 | 974,094 | 12/5/2024 |
| 3.2.2 | 9,928 | 12/3/2024 |
| 3.2.1 | 2,533 | 12/3/2024 |
| 3.2.0 | 16,954 | 11/30/2024 |
| 3.1.1 | 3,255,762 | 7/2/2024 |
| 3.1.0 | 354,400 | 5/1/2024 |
| 3.0.0.2 | 183,450 | 4/19/2024 |
| 3.0.0.1 | 1,540 | 4/19/2024 |
| 3.0.0 | 278,333 | 2/3/2024 |
| 2.1.0 | 959,123 | 6/12/2023 |
| 2.0.6 | 290,269 | 3/9/2023 |
| 2.0.5 | 6,953 | 3/7/2023 |
| 2.0.4 | 450,421 | 8/20/2022 |
| 2.0.3 | 3,089 | 8/12/2022 |
Release notes can be found at https://docs.json-everything.net/rn-json-patch/