fastjsonpatch
A drop-in replacement for jsonpatch
(RFC 6902) with make_patch and apply
written in Rust. It returns the same patches and documents as jsonpatch 1.34 and raises
exceptions with the same types and messages.
pip install fastjsonpatch
import fastjsonpatch as jsonpatch # the only line you change
src = {"name": "web", "replicas": 3, "ports": [80, 443]}
dst = {"name": "web", "replicas": 5, "ports": [80, 443, 8080]}
patch = jsonpatch.make_patch(src, dst)
patch.patch
# [{'op': 'replace', 'path': '/replicas', 'value': 5},
# {'op': 'add', 'path': '/ports/2', 'value': 8080}]
patch.apply(src) == dst # True; src is not modified
jsonpatch.apply_patch(src, [{"op": "remove", "path": "/ports/0"}])
# {'name': 'web', 'replicas': 3, 'ports': [443]}
Requires CPython 3.12+. Wheels are published for Linux (x86_64, aarch64; glibc and
musl), macOS (arm64, x86_64) and Windows (x64). The only dependency is jsonpointer.
Performance
Linux x86_64, Python 3.13, best of several runs:
| workload | jsonpatch | fastjsonpatch | speedup |
|---|---|---|---|
make_patch, Kubernetes OpenAPI v1.33 → v1.34 (3.7 → 3.8 MB, 283 ops) |
136.4 ms | 9.6 ms | 14x |
apply, the same 283 ops |
78.0 ms | 11.4 ms | 7x |
make_patch, 10k records with 100 field edits |
292.61 ms | 5.26 ms | 56x |
apply, the same 100 ops |
89.38 ms | 7.90 ms | 11x |
make_patch, small REST resource ×1000 |
74.4 ms | 5.6 ms | 13x |
apply_patch, small REST resource ×1000 |
47.4 ms | 7.5 ms | 6x |
Across all measured workloads, make_patch is 9-57x faster and apply 4-27x (4x is a
3-operation patch applied in_place to a 3.8 MB document, where no copy is made). On
Python 3.14, whose copy.deepcopy is faster, the apply speedup is smaller (about 6x
instead of 11x on the 10k-record workload). Full tables and an explanation of where
the time goes are in
BENCHMARKS.md;
python bench/compare.py (in the source distribution) measures on your machine.
Compatibility
fastjsonpatch is jsonpatch 1.34's module with JsonPatch.__init__ (validation),
JsonPatch.from_diff (make_patch) and JsonPatch.apply (apply_patch) routed to
Rust; every other public name is jsonpatch's own code. Inputs the Rust code does not
handle exactly fall back to jsonpatch's original code before anything is modified:
non-JSON values, dict or list subclasses, nesting deeper than 1000, a custom dumps=
or json_dumper, a custom pointer_cls, operations or _get_operation (for
apply), and operations that would fail.
Known differences:
- The exception classes are fastjsonpatch's own, so
except fastjsonpatch.JsonPatchConflictdoes not catch an exception raised by thejsonpatchpackage, and vice versa. - Values in a document that are not dicts, lists or JSON scalars are copied with
copy.deepcopyone by one, so aliasing between such values is not preserved. __version__is fastjsonpatch's version;__jsonpatch_version__is"1.34". jsonpatch's__author__and__website__are not defined.
Testing
About 1,580 tests: randomized comparisons against jsonpatch 1.34 (patches, documents and errors), jsonpatch's own test suite and doctests, and the json-patch-tests RFC 6902 suite. CI runs them with Python 3.12-3.14 on Linux (x86_64, aarch64; glibc), macOS (arm64, x86_64) and Windows (x64); the musl wheels are built but not tested in CI.
License
BSD-3-Clause. The Python module and the diff algorithm come from jsonpatch
(Copyright (c) 2011 Stefan Kögl, BSD). Licenses of the Rust crates compiled into the
wheels are in THIRD_PARTY_LICENSES.md. Development and release notes:
MAINTAINING.md.
Metadata
Release files for fastjsonpatch 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastjsonpatch-0.1.3.tar.gz | 55.8 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| fastjsonpatch-0.1.3-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details |
| fastjsonpatch-0.1.3-cp312-abi3-musllinux_1_2_x86_64.whl | CPython 3.12 | abi3 | Linux musl 1.2+ x86-64 | Details |
| fastjsonpatch-0.1.3-cp312-abi3-musllinux_1_2_aarch64.whl | CPython 3.12 | abi3 | Linux musl 1.2+ ARM64 | Details |
| fastjsonpatch-0.1.3-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| fastjsonpatch-0.1.3-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| fastjsonpatch-0.1.3-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details |
| fastjsonpatch-0.1.3-cp312-abi3-macosx_10_12_x86_64.whl | CPython 3.12 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 2.1 MB
Release files / fastjsonpatch-0.1.3.tar.gz
| Download URL | fastjsonpatch-0.1.3.tar.gz |
|---|---|
| Size | 55.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dcde58812cd343f31bf06e2273896876377962fa707110ee76d24927e9bd460d
|
|
BLAKE2b-256 checksum How to use checksums |
361ef2bf057c539303be3d67f568fb214d29d773a16fff964a2c965ef0978e0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 12, 2026.
Transparency logRelease files / fastjsonpatch-0.1.3-cp312-abi3-win_amd64.whl
| Download URL | fastjsonpatch-0.1.3-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 150.5 kB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4619ff1c9789cf940f2b702a9926a8007916c829d71ed69be86e7e2f7cc04d8d
|
|
BLAKE2b-256 checksum How to use checksums |
7beb6b126cbec83752176673880bab6891c177171202129fcda3819344463f13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 12, 2026.
Transparency logRelease files / fastjsonpatch-0.1.3-cp312-abi3-musllinux_1_2_x86_64.whl
| Download URL | fastjsonpatch-0.1.3-cp312-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 468.9 kB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
9a964c4c02971783550480df7d083f7fa3e5d0f8f9afbb6af1bfdbd6d809f612
|
|
BLAKE2b-256 checksum How to use checksums |
8dc29ed02a05e241f84214ab98d00edf4f6be815fe560699646587a28ec0e0d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 12, 2026.
Transparency logRelease files / fastjsonpatch-0.1.3-cp312-abi3-musllinux_1_2_aarch64.whl
| Download URL | fastjsonpatch-0.1.3-cp312-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 433.3 kB |
| Tags | CPython 3.12 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
d0bb8666d673be557e8ca346d5eccee7529eda92b8682c78f0211462a7ef1c6b
|
|
BLAKE2b-256 checksum How to use checksums |
3abd9ae435db636808dc5ac7d07518c898753fb06675a3e384b6dbcff562cd0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 12, 2026.
Transparency logRelease files / fastjsonpatch-0.1.3-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fastjsonpatch-0.1.3-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 257.2 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c943d9604bf5811f1ddbaad6bd219ccfbe7b33abf6fab5cf438f1abbc5820758
|
|
BLAKE2b-256 checksum How to use checksums |
fc17721fb925470e27095f791a4ffb8fd610e36b0f2b1c41aff715bdd53de621
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 12, 2026.
Transparency logRelease files / fastjsonpatch-0.1.3-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | fastjsonpatch-0.1.3-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 254.5 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
cfc9906ee953692ad7e68c78c44f0bdfd60ec391fefc6e015ce19c3461817008
|
|
BLAKE2b-256 checksum How to use checksums |
0d2e48a5152fa2e7f5347e179e8a32e185f0af6e15ba4f27382b7729098939f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 12, 2026.
Transparency logRelease files / fastjsonpatch-0.1.3-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | fastjsonpatch-0.1.3-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 239.5 kB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
19a84da357e980a65fbc9df0e4f1100295f73d77c8164a6ff0b40e54c49a6577
|
|
BLAKE2b-256 checksum How to use checksums |
ca0b32c83057a47e2a629dece87bbaa836da0c78101be24354235a989a6bff59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 12, 2026.
Transparency logRelease files / fastjsonpatch-0.1.3-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | fastjsonpatch-0.1.3-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 252.4 kB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
f7355be7070f94a32616a54da1a566d638b43a6d6550d66998d233fe98d9664a
|
|
BLAKE2b-256 checksum How to use checksums |
b7b532f156b17f6247f84818a3ef752998e9aab3ef38ad3a4c4097d24120e55d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 12, 2026.
Transparency log