Skip to main content

JsonPatchX

Tests Codecov OpenSSF Scorecard Contributor Covenant PyPI Version Python Versions License

JSON Patch for modern PATCH APIs. Tested against the RFC 6902 Compliance Test Suite.

Built on Pydantic models, with typed JSON Pointer / JSONPath targeting, custom patch operations, and first-class support for FastAPI PATCH routes and OpenAPI generation.

Table of Contents

Install

pip install jsonpatchx

For FastAPI integrations:

pip install jsonpatchx[fastapi]

Links

Examples

1. Standard RFC 6902

from jsonpatchx import JsonPatch

doc = {"name": "Ada", "roles": ["engineer"]}

patch = JsonPatch.from_string(
    """
    [
      {"op": "replace", "path": "/name", "value": "Ada Lovelace"},
      {"op": "add", "path": "/roles/-", "value": "maintainer"}
    ]
    """
)

updated = patch.apply(doc)

2. The FastAPI Contract

from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
from jsonpatchx import JsonPatchFor

class User(BaseModel):
    id: int
    email: EmailStr
    active: bool

app = FastAPI()

@app.patch("/users/{user_id}", response_model=User)
def patch_user(user_id: int, patch: JsonPatchFor[User]) -> User:
    user = load_user(user_id)
    updated = patch.apply(user)
    save_user(user_id, updated)
    return updated

Note: For custom operations, JSONPath targeting, route-level controls, and more, see the User Guide.

Contributing

See CONTRIBUTING.md for local setup, checks, docs preview, and pull request expectations.

Use Discussions for project-specific design conversation, issues for concrete bugs or proposed work, and the broader json-patch2 forum for standards discussion.

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Angela Liss - chamsester@gmail.com

Project Link: https://github.com/angela-tarantula/jsonpatchx

Acknowledgements

Thanks to these foundational projects:

And to these excellent alternatives:

Metadata

Release files for jsonpatchx 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jsonpatchx 0.1.0
File Size Uploaded
jsonpatchx-0.1.0.tar.gz 41.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jsonpatchx 0.1.0
File Interpreter ABI Platform
jsonpatchx-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 86.5 kB

Release files / jsonpatchx-0.1.0.tar.gz

Download URL jsonpatchx-0.1.0.tar.gz
Size 41.6 kB
Tags Source
SHA-256 checksum
How to use checksums
234d3b725d2751a81ef51930b0e8c336fa2c5491be7a843b1a85b08c824f1ade
BLAKE2b-256 checksum
How to use checksums
cecc61d30b11cf2690aeea783b460587d9952a04187679cae5b913b01751e92a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.

Transparency log

Release files / jsonpatchx-0.1.0-py3-none-any.whl

Download URL jsonpatchx-0.1.0-py3-none-any.whl
Size 44.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0bce314a19515090dc464ce11fa59e66905c2eda9b51bfbf0897ccbae68c8034
BLAKE2b-256 checksum
How to use checksums
f34a9963ceeb4f114a9f87e318226c0b44e0f9b394e983f809bb27a86cdd4562
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page