SystemTextJsonPatch 1.2.0
See the version list below for details.
dotnet add package SystemTextJsonPatch --version 1.2.0
NuGet\Install-Package SystemTextJsonPatch -Version 1.2.0
<PackageReference Include="SystemTextJsonPatch" Version="1.2.0" />
paket add SystemTextJsonPatch --version 1.2.0
#r "nuget: SystemTextJsonPatch, 1.2.0"
// Install SystemTextJsonPatch as a Cake Addin #addin nuget:?package=SystemTextJsonPatch&version=1.2.0 // Install SystemTextJsonPatch as a Cake Tool #tool nuget:?package=SystemTextJsonPatch&version=1.2.0
System Text Json Patch
SystemTextJsonPatch is a JSON Patch (JsonPatchDocument) RFC 6902 implementation for .NET using System.Text.Json
This library tries to ease the migration from Newtonsoft.Json to System.Text.Json by providing similar API for HttpPatch requests as in Microsoft.AspNetCore.JsonPatch and Marvin.JsonPatch
- Designed as an easy replacement for Microsoft.AspNetCore.JsonPatch
- Supports .NET 6 & netstandard2.0
Getting started
To enable JsonPatchDocument serialization support add SystemTextJsonPatch.Converters.JsonPatchDocumentConverterFactory to System.Text.Json serialization options converters. This is typically done in startup.cs file when configuring Asp.Net core MVC settings
public void ConfigureServices(IServiceCollection services)
{
services
.AddControllers()
.AddJsonOptions((options) =>
{
options.JsonSerializerOptions.Converters.Add(new SystemTextJsonPatch.Converters.JsonPatchDocumentConverterFactory());
});
}
or when using System.Text.Json.JsonSerializer directly with custom settings.
var jsonOptions = new JsonSerializerOptions()
{
Converters =
{
new SystemTextJsonPatch.Converters.JsonPatchDocumentConverterFactory()
}
};
var json = System.Text.Json.JsonSerializer.JsonSerializer.Serialize(incomingOperations, jsonOptions);
Performance comparison
This test deserializes a JSON patch document of 8 operations and applies the changes to a new model.
See SystemTextJsonPatch.Benchmark for more details.
BenchmarkDotNet=v0.13.2, OS=Windows 11 (10.0.22000.978/21H2) AMD Ryzen 9 5950X, 1 CPU, 32 logical and 16 physical cores .NET SDK=7.0.100-rc.1.22431.12 [Host] : .NET 6.0.9 (6.0.922.41905), X64 RyuJIT AVX2 Job-URORCR : .NET 6.0.9 (6.0.922.41905), X64 RyuJIT AVX2
WarmupCount=2
Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
---|---|---|---|---|---|---|
SystemTextJsonPatch | 7.233 us | 0.0381 us | 0.0356 us | 0.3738 | - | 6.16 KB |
MarvinJsonPatch | 979.525 us | 9.9310 us | 8.8036 us | 5.8594 | 3.9063 | 98.13 KB |
AspNetCoreJsonPatch | 26.645 us | 0.2023 us | 0.1892 us | 2.5940 | 0.0610 | 42.49 KB |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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 is compatible. 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. |
.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
- System.Text.Json (>= 6.0.7)
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
NuGet packages (8)
Showing the top 5 NuGet packages that depend on SystemTextJsonPatch:
Package | Downloads |
---|---|
MediatR.CommandQuery
CQRS framework based on MediatR |
|
SurrealDb.Net
The official SurrealDB library for .NET |
|
Delobytes.AspNetCore.Swagger
Middlewares, MVC filters, extension methods and helper code for ASP.NET Core projects with Swagger (OpenAPI). |
|
Sparc.Blossom.Core
Blossom Core package |
|
SurrealDb.Reactive
Reactive Extensions for the SurrealDB library for .NET |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on SystemTextJsonPatch:
Repository | Stars |
---|---|
Azure/Bridge-To-Kubernetes
Bridge To Kubernetes (B2K) is development tool to debug microservices, pods which redirects traffic to your local development machine and vice versa.
|
|
surrealdb/surrealdb.net
SurrealDB SDK for .NET
|
Version | Downloads | Last updated |
---|---|---|
4.2.0 | 126 | 1/17/2025 |
4.1.0 | 14,256 | 11/15/2024 |
4.0.0 | 21,977 | 10/18/2024 |
3.3.0 | 195,024 | 10/5/2024 |
3.2.1 | 80,216 | 8/7/2024 |
3.2.0 | 65,468 | 5/30/2024 |
3.1.0 | 205,218 | 11/14/2023 |
3.0.1 | 70,968 | 8/21/2023 |
3.0.0 | 1,606 | 8/14/2023 |
2.0.2 | 18,496 | 7/16/2023 |
2.0.1 | 22,466 | 3/21/2023 |
2.0.0 | 277 | 3/21/2023 |
1.2.0 | 32,247 | 2/5/2023 |
1.1.0 | 9,714 | 1/18/2023 |
1.0.0 | 50,303 | 10/2/2022 |
0.0.9 | 7,210 | 9/11/2022 |
0.0.8 | 3,858 | 8/11/2022 |
0.0.7 | 2,977 | 6/17/2022 |
0.0.6 | 469 | 6/17/2022 |
0.0.5 | 2,317 | 5/24/2022 |
0.0.4 | 485 | 5/24/2022 |
0.0.3 | 481 | 5/23/2022 |
0.0.2 | 511 | 5/23/2022 |
0.0.1 | 1,118 | 5/19/2022 |