October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

What’s New in .NET 10: JSON Patch for ASP.NET Core Web APIs

ASP.NET Core 10 adds a System.Text.Json-based JSON Patch package. See how to apply typed patch documents, assess migration compatibility, and restrict unsafe changes.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

.NET 10 adds an ASP.NET Core JSON Patch implementation based on System.Text.Json. To use it, install the Microsoft.AspNetCore.JsonPatch.SystemTextJson NuGet package, bind a patch document to JsonPatchDocument<T>, and apply it to the target model with ApplyTo. The new implementation is not a drop-in replacement for the older Newtonsoft.Json-based one, and your API—not the library—must decide which client-requested changes are safe.

What changed in .NET 10?

ASP.NET Core 10 introduces JSON Patch support based on System.Text.Json through the Microsoft.AspNetCore.JsonPatch.SystemTextJson package. It provides JsonPatchDocument<TModel> and custom serialization and deserialization for JSON Patch documents. Microsoft describes the implementation as offering improved performance and reduced memory use compared with the legacy implementation, but does not provide a numeric benchmark in the cited release notes. Microsoft’s ASP.NET Core 10 release notes

As an Amazon Associate I earn from qualifying purchases.

The package is separate from the framework’s older Newtonsoft.Json-based implementation. Microsoft explicitly warns that the System.Text.Json implementation “isn’t a drop-in replacement” for the legacy one. It does not support dynamic types such as ExpandoObject. Before migrating, check the target models your application patches, how patch documents are serialized and deserialized, and how your endpoints handle application errors. Microsoft Learn: JSON Patch in ASP.NET Core web API

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How does a JSON Patch document work?

A JSON Patch document is an ordered array of operations against a JSON-shaped resource. The standard operations are add, remove, replace, move, copy, and test. Each operation uses a slash-separated path; array indexes are zero-based, and - can identify the end of an array for an append, such as /addresses/-. Microsoft Learn: JSON Patch in ASP.NET Core web API

In an ASP.NET Core controller, the common flow is to accept a JsonPatchDocument<TModel>, apply it to the model with ApplyTo, then validate and persist the resulting resource according to your API’s rules. Microsoft also documents a Minimal API pattern using MapPatch. The endpoint determines how binding failures and operation errors are reported, so define and test that behavior rather than assuming every invalid patch produces the same response.

Applying a patch in an endpoint

The essential controller pattern is to receive the typed document and call ApplyTo on the resource being changed. The package supplies the patch document type and serialization support; the endpoint remains responsible for locating the resource, checking the caller’s permissions, validating the result, and saving it.

[HttpPatch("{id}")]
public IActionResult Patch(int id, JsonPatchDocument<Product> patch)
{
    if (patch is null)
        return BadRequest();

    var product = FindProduct(id);
    if (product is null)
        return NotFound();

    patch.ApplyTo(product);

    if (!ModelState.IsValid)
        return ValidationProblem(ModelState);

    // Apply domain validation and persist the product here.
    return Ok(product);
}

This illustrates the shape of the flow, not a complete application: FindProduct, persistence, authorization, and domain validation depend on your API. Follow the package and framework documentation for the exact endpoint setup for your project. Microsoft Learn: JSON Patch in ASP.NET Core web API

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

JSON Patch application is atomic: if an operation fails, none of the operations in the list is applied. A client should therefore treat a failed patch as unapplied and retrieve or reconcile resource state using the API’s contract. Microsoft Learn: JSON Patch in ASP.NET Core web API

How to choose between the System.Text.Json and Newtonsoft.Json implementations

Consideration System.Text.Json implementation (.NET 10) Legacy implementation
Package and serialization Microsoft.AspNetCore.JsonPatch.SystemTextJson; System.Text.Json-based serialization. Uses Newtonsoft.Json integration.
Model compatibility Dynamic types such as ExpandoObject are unsupported. Compatibility depends on the existing Newtonsoft.Json-based setup; check your application’s target models.
Applying patches and handling errors Uses JsonPatchDocument<TModel> and ApplyTo; verify how your endpoint captures and returns errors. Review the current endpoint’s patch-application and error-handling behavior before changing implementations.
Security Does not make arbitrary client-supplied changes safe; the application must control what may be changed. Also requires application-level controls over permitted changes.

For migration, first identify the document and model shapes your app relies on, then check its JSON configuration, patch parsing and creation paths, and failure handling. This is especially important if a patch target is dynamic or your clients depend on undocumented serialization behavior. The warning that the implementations are not interchangeable does not mean every behavior differs; test the areas your application actually uses.

Security: decide what clients may change

Microsoft warns that JSON Patch has inherent security risks and that the ASP.NET Core implementation does not attempt to mitigate them. Treat the operation list and its paths as untrusted input. A successfully parsed patch is not, by itself, authorization to change every field on the model. Microsoft Learn: JSON Patch in ASP.NET Core web API

  • Allow only the operations and paths appropriate for the resource and caller.
  • Enforce authorization before applying changes; do not expose sensitive or server-controlled fields for client editing.
  • Validate domain rules after applying the patch, including relationships and invariants that span multiple fields.
  • Test invalid paths, unsupported operations, failed operations, and the endpoint’s error responses.

These checks belong to the application because the library does not decide which changes are safe for your domain.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Package and version scope

The documentation and release notes cited here cover ASP.NET Core 10.0. Microsoft’s API reference lists the package-provided Microsoft.AspNetCore.JsonPatch.SystemTextJson v10.0.0 API. Confirm the package version and behavior against the framework version your project targets. Microsoft API reference: System.Text.Json JSON Patch API for ASP.NET Core 10.0

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.