JsonPatch.Net
3.1.1
dotnet add package JsonPatch.Net --version 3.1.1
NuGet\Install-Package JsonPatch.Net -Version 3.1.1
<PackageReference Include="JsonPatch.Net" Version="3.1.1" />
paket add JsonPatch.Net --version 3.1.1
#r "nuget: JsonPatch.Net, 3.1.1"
// Install JsonPatch.Net as a Cake Addin #addin nuget:?package=JsonPatch.Net&version=3.1.1 // Install JsonPatch.Net as a Cake Tool #tool nuget:?package=JsonPatch.Net&version=3.1.1
Summary
JsonPatch.Net implements JSON Patch, RFC 6902, a JSON document structure for expressing a sequence of operations to apply to another JSON document.
Links
Usage
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]}}
]
*/
Sponsorship
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 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 is compatible. 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. |
.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 was computed. 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. |
-
.NETStandard 2.0
- JsonPointer.Net (>= 5.0.2)
-
net8.0
- JsonPointer.Net (>= 5.0.2)
NuGet packages (13)
Showing the top 5 NuGet packages that depend on JsonPatch.Net:
Package | Downloads |
---|---|
Proto.Cluster.Kubernetes
Ultra-fast distributed actors for .NET. |
|
Altinn.App.Core
This class library holds all the core features used by a standard Altinn 3 App. |
|
Umbraco.Cms.Api.Management
Contains the presentation layer for the Umbraco CMS Management API. |
|
Azure.Deployments.Extensibility.Core
Package Description |
|
Azure.Bicep.Core
Bicep compiler core functionality. The Bicep team has made this NuGet package publicly available on nuget.org. While it is public, it is not a supported package. Any dependency you take on this package will be done at your own risk and we reserve the right to push breaking changes to this package at any time. |
GitHub repositories (5)
Showing the top 5 popular GitHub repositories that depend on JsonPatch.Net:
Repository | Stars |
---|---|
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
|
|
NosCoreIO/NosCore
NosCore is a Nostale emulator in c# (.Net 8) using DotNetty / Entity Framework / WebAPI / Autofac / Mapster / Serilog
|
|
corvus-dotnet/Corvus.JsonSchema
Support for Json Schema validation and entity generation
|
Version | Downloads | Last updated |
---|---|---|
3.1.1 | 151,931 | 7/2/2024 |
3.1.0 | 132,105 | 5/1/2024 |
3.0.0.2 | 36,365 | 4/19/2024 |
3.0.0.1 | 116 | 4/19/2024 |
3.0.0 | 168,140 | 2/3/2024 |
2.1.0 | 650,875 | 6/12/2023 |
2.0.6 | 258,934 | 3/9/2023 |
2.0.5 | 5,443 | 3/7/2023 |
2.0.4 | 378,867 | 8/20/2022 |
2.0.3 | 1,695 | 8/12/2022 |
2.0.2 | 43,249 | 6/18/2022 |
2.0.1 | 19,029 | 6/16/2022 |
2.0.0 | 2,195 | 6/13/2022 |
1.1.2 | 277,060 | 12/5/2021 |
1.1.1 | 3,214 | 11/11/2021 |
1.1.0 | 60,991 | 9/13/2021 |
1.0.6 | 9,801 | 7/25/2021 |
1.0.5 | 2,364 | 6/20/2021 |
1.0.4 | 12,406 | 1/1/2021 |
1.0.3 | 613 | 12/19/2020 |
1.0.1 | 539 | 10/18/2020 |
1.0.0 | 683 | 10/16/2020 |
Release notes can be found at https://docs.json-everything.net/rn-json-patch/