Skip to main content

python-json-patch

PyPI version Supported Python versions Build Status Coverage Status

Applying JSON Patches in Python

Library to apply JSON Patches according to RFC 6902

See the tutorial for examples.

String append extension

JsonPatchWithAppend is a drop-in replacement for JsonPatch with a non-RFC string append operation. Its from_diff() method sends only the new suffix when an object member's string grows. JsonPatch, make_patch() and apply_patch() retain their standard RFC 6902 behavior.

See the tutorial for examples. Both sender and receiver must support the extension.

Type hints

jsonpatch ships type stubs (in the jsonpatch-stubs directory, as jsonpatch.py is a single-file module), so type checkers such as mypy and pyright work with it without further setup. JSON documents are typed as Any.

When changing the public API of jsonpatch.py, update jsonpatch-stubs/__init__.pyi as well. These check that both agree, and that typical usage in typetests/usage.py type-checks:

pip install mypy .
python -m mypy.stubtest --mypy-config-file pyproject.toml jsonpatch
cd typetests && mypy --config-file ../pyproject.toml usage.py

Running tests

pip install -r requirements.txt -r requirements-dev.txt
python tests.py

Running external tests

To run external tests (such as those from https://github.com/json-patch/json-patch-tests) use ext_tests.py

./ext_tests.py ../json-patch-tests/tests.json

Running property-based tests

Property-based tests using Hypothesis are in property_tests.py.

pip install hypothesis
python property_tests.py

Set HYPOTHESIS_PROFILE=thorough to run many more examples.

Metadata

Release files for jsonpatch 1.47

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

Source distribution (sdist)

Source distribution for jsonpatch 1.47
File Size Uploaded Provenance Actions
jsonpatch-1.47.tar.gz 80.4 kB With provenance Details for jsonpatch-1.47.tar.gz

Built distribution (wheel)

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

Total release size: 105.7 kB

Release files / jsonpatch-1.47.tar.gz

Download URL jsonpatch-1.47.tar.gz
Size 80.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5ed650b7517789e0f43428aa7b09442c0b90de0a0fd17a53fd0ebf55205c601e
BLAKE2b-256 checksum
How to use checksums
8f1343ae689f9340dc7339dc7f5a3b1772edcd48fb1eb62fd5d801a2aa09d382
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 11, 2026.

Transparency log

Release files / jsonpatch-1.47-py3-none-any.whl

Download URL jsonpatch-1.47-py3-none-any.whl
Size 25.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9ba6de59c481bf2be05041514ecb0d97f994aa645c4e00831805dbe2281811a
BLAKE2b-256 checksum
How to use checksums
5de9a09b859f5fbd7a192ed40f9098fb746607ab46eaacc1eecaea713e4df0de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 11, 2026.

Transparency log

Security for jsonpatch 1.47

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for jsonpatch-1.47.tar.gz

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 Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.47 This release

2 release files Full provenance

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