VOOZH about

URL: https://www.nuget.org/packages/SystemTextJsonPatch/

⇱ NuGet Gallery | SystemTextJsonPatch 5.0.0




👁 Image
SystemTextJsonPatch 5.0.0

dotnet add package SystemTextJsonPatch --version 5.0.0
 
 
NuGet\Install-Package SystemTextJsonPatch -Version 5.0.0
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SystemTextJsonPatch" Version="5.0.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SystemTextJsonPatch" Version="5.0.0" />
 
Directory.Packages.props
<PackageReference Include="SystemTextJsonPatch" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SystemTextJsonPatch --version 5.0.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SystemTextJsonPatch, 5.0.0"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SystemTextJsonPatch@5.0.0
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SystemTextJsonPatch&version=5.0.0
 
Install as a Cake Addin
#tool nuget:?package=SystemTextJsonPatch&version=5.0.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

👁 SystemTextJsonPatchLogo

👁 CI status
👁 Nuget

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+ including .NET 10, plus netstandard2.0

Getting started

Build a patch document on the client. You can use the operations as described in the IETF document: Add, Remove, Replace, Copy, Move and Test.

List<Operation<DTO.Expense>> operations = [];
JsonSerializerOptions jsonOptions = new JsonSerializerOptions();
JsonPatchDocument<DTO.Expense> expensePatch = new JsonPatchDocument<DTO.Expense>(operations, jsonOptions);
expensePatch.Replace(e => e.Description, expense.Description);

// serialize it to JSON
var expensePatchJson = System.Text.Json.JsonSerializer.Serialize(expensePatch);

On your API, in the patch method (accept document as parameter & use ApplyTo method)

[Route("api/expenses/{id}")]
[HttpPatch]
public IHttpActionResult Patch(
 int id,
 [FromBody] JsonPatchDocument<DTO.Expense> expensePatchDocument
)
{
 // get the expense from the repository
 var expense = _repository.GetExpense(id);

 // apply the patch document 
 expensePatchDocument.ApplyTo(expense);

 // changes have been applied to expense object
}

Deny access to properties

If you need to stop JsonPatch from reading or writing to some properties, then you can decorate them with [DenyPatch], if a patch occurs that happens to access the property then a JsonPatchAccessDeniedException is thrown.

Migration from v1

JsonPatchDocumentConverterFactory no longer needs to be set to JsonSerializerOptions. Instead JsonPatchDocument types now use JsonConvertAttribute to use the correct converter.

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.15.8, Windows 11 (10.0.26200.8117/25H2/2025Update/HudsonValley2) AMD Ryzen 9 5950X 3.40GHz, 1 CPU, 32 logical and 16 physical cores .NET SDK 10.0.201 [Host] : .NET 10.0.5 (10.0.5, 10.0.526.15411), X64 RyuJIT x86-64-v3 Job-PGIYFE : .NET 10.0.5 (10.0.5, 10.0.526.15411), X64 RyuJIT x86-64-v3

WarmupCount=2

Method Mean Error StdDev Gen0 Gen1 Allocated
SystemTextJsonPatch 3.495 us 0.0409 us 0.0362 us 0.2823 - 4.63 KB
MarvinJsonPatch 815.664 us 15.7153 us 18.7079 us 3.9063 1.9531 68.01 KB
AspNetCoreJsonPatch 14.385 us 0.2321 us 0.2172 us 2.5940 0.0610 42.56 KB
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 is compatible.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

  • net10.0

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (12)

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

Arbiter.CommandQuery

Command Query Responsibility Segregation (CQRS) framework based on mediator pattern

Sparc.Core

Blossom Core package

Delobytes.AspNetCore.Swagger

Middlewares, MVC filters, extension methods and helper code for ASP.NET Core projects with Swagger (OpenAPI).

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
5.0.0 100,700 4/2/2026
4.2.0 1,262,869 1/17/2025
4.1.0 504,383 11/15/2024
4.0.0 492,534 10/18/2024
3.3.0 2,437,669 10/5/2024
3.2.1 639,138 8/7/2024
3.2.0 603,314 5/30/2024
3.1.0 764,549 11/14/2023
3.0.1 527,677 8/21/2023
3.0.0 429,092 8/14/2023
2.0.2 448,093 7/16/2023
2.0.1 456,205 3/21/2023
2.0.0 429,710 3/21/2023
1.2.0 463,820 2/5/2023
1.1.0 437,354 1/18/2023
1.0.0 489,645 10/2/2022
0.0.9 434,453 9/11/2022
0.0.8 431,180 8/11/2022
0.0.7 430,244 6/17/2022
0.0.6 427,719 6/17/2022
Loading failed