JsonPatch.Net 3.3.0
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.
Showing the top 20 packages that depend on JsonPatch.Net.
| Packages | Downloads |
|---|---|
|
Aspire.Hosting
Core abstractions for the .NET Aspire application model.
|
1 |
|
Aspire.Hosting
Core abstractions for the .NET Aspire application model.
|
67 |
|
Aspire.Hosting.AppHost
Core library and MSBuild logic for .NET Aspire AppHost projects.
|
1 |
|
Aspire.Hosting.AppHost
Core library and MSBuild logic for .NET Aspire AppHost projects.
|
67 |
|
Aspire.Hosting.RabbitMQ
RabbitMQ support for .NET Aspire.
|
1 |
|
Aspire.Hosting.RabbitMQ
RabbitMQ support for .NET Aspire.
|
69 |
|
Aspire.Hosting.Redis
Redis® support for .NET Aspire.
|
1 |
|
Aspire.Hosting.Redis
Redis® support for .NET Aspire.
|
2 |
|
Aspire.Hosting.Redis
Redis® support for .NET Aspire.
|
67 |
|
Aspire.Hosting.SqlServer
Microsoft SQL Server support for .NET Aspire.
|
2 |
|
Aspire.Hosting.SqlServer
Microsoft SQL Server support for .NET Aspire.
|
67 |
Release notes can be found at https://docs.json-everything.net/rn-json-patch/
.NET 8.0
- JsonPointer.Net (>= 5.2.0)
.NET 9.0
- JsonPointer.Net (>= 5.2.0)
.NET Standard 2.0
- JsonPointer.Net (>= 5.2.0)
| Version | Downloads | Last updated |
|---|---|---|
| 4.0.0 | 0 | 2025-12-09 |
| 3.3.0 | 68 | 2025-09-26 |
| 3.2.3 | 0 | 2024-12-05 |
| 3.2.2 | 0 | 2024-12-03 |
| 3.2.1 | 0 | 2024-12-03 |
| 3.2.0 | 0 | 2024-11-30 |
| 3.1.1 | 0 | 2024-07-02 |
| 3.1.0 | 0 | 2024-05-01 |
| 3.0.0.2 | 0 | 2024-04-19 |
| 3.0.0.1 | 0 | 2024-04-19 |
| 3.0.0 | 0 | 2024-02-03 |
| 2.1.0 | 0 | 2023-06-12 |
| 2.0.6 | 0 | 2023-03-09 |
| 2.0.5 | 0 | 2023-03-07 |
| 2.0.4 | 0 | 2022-08-20 |
| 2.0.3 | 0 | 2022-08-12 |
| 2.0.2 | 0 | 2022-06-18 |
| 2.0.1 | 0 | 2022-06-16 |
| 2.0.0 | 0 | 2022-06-13 |
| 1.1.2 | 0 | 2021-12-05 |
| 1.1.1 | 0 | 2021-11-11 |
| 1.1.0 | 0 | 2021-09-13 |
| 1.0.6 | 0 | 2021-07-25 |
| 1.0.5 | 0 | 2021-06-20 |
| 1.0.4 | 0 | 2021-01-01 |
| 1.0.3 | 0 | 2020-12-19 |
| 1.0.1 | 0 | 2020-10-18 |
| 1.0.0 | 0 | 2020-10-16 |