Skip to main content

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.JsonPatchConflict does not catch an exception raised by the jsonpatch package, and vice versa.
  • Values in a document that are not dicts, lists or JSON scalars are copied with copy.deepcopy one 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.4

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

Source distribution (sdist)

Source distribution for fastjsonpatch 0.1.4
File Size Uploaded
fastjsonpatch-0.1.4.tar.gz 57.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for fastjsonpatch 0.1.4
File
fastjsonpatch-0.1.4-cp312-abi3-win_amd64.whl CPython 3.12 abi3 Windows x86-64 Details
fastjsonpatch-0.1.4-cp312-abi3-musllinux_1_2_x86_64.whl CPython 3.12 abi3 Linux musl 1.2+ x86-64 Details
fastjsonpatch-0.1.4-cp312-abi3-musllinux_1_2_aarch64.whl CPython 3.12 abi3 Linux musl 1.2+ ARM64 Details
fastjsonpatch-0.1.4-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.4-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.12 abi3 Linux glibc 2.17+ ARM64 Details
fastjsonpatch-0.1.4-cp312-abi3-macosx_11_0_arm64.whl CPython 3.12 abi3 macOS 11.0+ ARM64 Details
fastjsonpatch-0.1.4-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.4.tar.gz

Download URL fastjsonpatch-0.1.4.tar.gz
Size 57.0 kB
Tags Source
SHA-256 checksum
How to use checksums
820e61303c4bf2a1ae17d2080797e369a631dd071c7bab2d6b14786a7aff3df0
BLAKE2b-256 checksum
How to use checksums
6231732f20634dfda5d978b2332b20aa69278aab8eaab287fd81390b6f230467
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

Release files / fastjsonpatch-0.1.4-cp312-abi3-win_amd64.whl

Download URL fastjsonpatch-0.1.4-cp312-abi3-win_amd64.whl
Size 150.7 kB
Tags CPython 3.12 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
48506efe5509f1b9351965fe257e83911014948b25f2d2868dfc42667e5b2cfe
BLAKE2b-256 checksum
How to use checksums
abd489e5f4f85aa148e5511b57fd64822809c996ea7487cc3bb4beb23f047346
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

Release files / fastjsonpatch-0.1.4-cp312-abi3-musllinux_1_2_x86_64.whl

Download URL fastjsonpatch-0.1.4-cp312-abi3-musllinux_1_2_x86_64.whl
Size 469.1 kB
Tags CPython 3.12 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
38a6655cb077f9ce7e8625a4b487632d5ebcb75b51d67029aadc92c385e60fa6
BLAKE2b-256 checksum
How to use checksums
713bf72bc5b3b0e6a75c21f8ae8e301314f76c70c14b330b45bcdaa2ba031267
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

Release files / fastjsonpatch-0.1.4-cp312-abi3-musllinux_1_2_aarch64.whl

Download URL fastjsonpatch-0.1.4-cp312-abi3-musllinux_1_2_aarch64.whl
Size 433.5 kB
Tags CPython 3.12 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
d7f9c920b821a7d3a056ed702ce4e903c03cf77d780350a8c879a267bea3aadb
BLAKE2b-256 checksum
How to use checksums
ae93d9c4a067064eb36b87053b08d61d140a0c32077478c38b9d03387f45dab1
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

Release files / fastjsonpatch-0.1.4-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL fastjsonpatch-0.1.4-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 257.4 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
96598b1c3495afb2f9f2b221dd9735abd0acf323ce9827ed2576158d32d17dc1
BLAKE2b-256 checksum
How to use checksums
3490548f4a7a81781b5a0bd1770be6adecfa1453d5fa595b3ea284a0e41a45b7
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

Release files / fastjsonpatch-0.1.4-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL fastjsonpatch-0.1.4-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 254.9 kB
Tags CPython 3.12 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
d9eee70ad5abde78832ad4bd93122592a28d4a33a9cbc79b40c9b2c051ba7d4a
BLAKE2b-256 checksum
How to use checksums
a4037d8129e5f23e2bed8b60b93af97121125c236571b6eddb71c70da16fb8fd
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

Release files / fastjsonpatch-0.1.4-cp312-abi3-macosx_11_0_arm64.whl

Download URL fastjsonpatch-0.1.4-cp312-abi3-macosx_11_0_arm64.whl
Size 239.9 kB
Tags CPython 3.12 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c865616b6804cc436b17ff6112652445fd3f0e12f3bcbfbe6f38ff2edb63817b
BLAKE2b-256 checksum
How to use checksums
175aab557e6bbd0eacc1127c4a97ebb46a0f06517e1133d97b915959dd7b36e5
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

Release files / fastjsonpatch-0.1.4-cp312-abi3-macosx_10_12_x86_64.whl

Download URL fastjsonpatch-0.1.4-cp312-abi3-macosx_10_12_x86_64.whl
Size 252.7 kB
Tags CPython 3.12 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
4b35692c5db3cdad5afae2f9cf941fd0dfcc4424971239f435788495cffab3a5
BLAKE2b-256 checksum
How to use checksums
b30e9609be7b14157404a964068a5988f90b9d21568bc2fd21e87b32a758d06c
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

Release history Release notifications | RSS feed

This release

0.1.4 This release

8 release files

0.1.3

8 release files

0.1.2

8 release files

0.1.0

8 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