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 (16)
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 |
|
Neuroglia.Data.PatchModel
Package Description |
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 | 170,413 | 7/2/2024 |
3.1.0 | 137,277 | 5/1/2024 |
3.0.0.2 | 37,864 | 4/19/2024 |
3.0.0.1 | 116 | 4/19/2024 |
3.0.0 | 170,100 | 2/3/2024 |
2.1.0 | 655,280 | 6/12/2023 |
2.0.6 | 259,312 | 3/9/2023 |
2.0.5 | 5,445 | 3/7/2023 |
2.0.4 | 379,815 | 8/20/2022 |
2.0.3 | 1,695 | 8/12/2022 |
2.0.2 | 43,441 | 6/18/2022 |
2.0.1 | 19,047 | 6/16/2022 |
2.0.0 | 2,402 | 6/13/2022 |
1.1.2 | 278,034 | 12/5/2021 |
1.1.1 | 3,214 | 11/11/2021 |
1.1.0 | 61,010 | 9/13/2021 |
1.0.6 | 9,859 | 7/25/2021 |
1.0.5 | 2,364 | 6/20/2021 |
1.0.4 | 12,428 | 1/1/2021 |
1.0.3 | 613 | 12/19/2020 |
1.0.1 | 539 | 10/18/2020 |
1.0.0 | 684 | 10/16/2020 |
Release notes can be found at https://docs.json-everything.net/rn-json-patch/