Skip to main content

Rust-backed repair of malformed JSON for LLM-style outputs

Project description

repairjson

Blazing-fast JSON repair for messy LLM output.

repairjson is a Rust-powered drop-in repair layer for malformed JSON in Python. It is built for the reality of modern LLM pipelines: broken commas, single quotes, unquoted keys, truncated payloads, Markdown fences, and half-finished responses that still need to get through production systems.

If json.loads() is too strict and Python-side repair is too slow, this is the fast path.

Why repairjson

  • Rust core with a single-pass repair engine
  • designed for malformed LLM-style JSON, not just clean parser input
  • published PyPI wheels
  • benchmarked at roughly ~200x average speedup versus Python json_repair on the current 20 MB malformed corpus suite

What It Repairs

  • single-pass byte-oriented repair
  • support for single-quoted strings
  • support for Python literals like True, False, and None
  • repair of unquoted object keys
  • repair of missing commas and trailing commas
  • auto-closing of truncated objects and arrays
  • stripping of leading and trailing Markdown code fences

Install

pip install repairjson

Fast Example

python -c "import repairjson; print(repairjson.repair(\"{user: 'alice', active: True, tags: ['x', 'y',],}\"))"

Output:

{"user":"alice","active":true,"tags":["x","y"]}

Usage

import repairjson

fixed = repairjson.repair("{user: 'alice', active: True, tags: ['x', 'y',],}")
print(fixed)
# {"user":"alice","active":true,"tags":["x","y"]}

obj = repairjson.loads("{user: 'alice', active: True, tags: ['x', 'y',],}")
print(obj)
# {'user': 'alice', 'active': True, 'tags': ['x', 'y']}

Performance

Current benchmark suite: six synthetic 20 MB malformed-JSON datasets modeled after LLM-style output patterns.

  • dense_object: 206.2x
  • fenced_payload: 202.81x
  • chatty_nested: 242.24x
  • long_text: 198.91x
  • array_heavy: 209.86x
  • truncated_nested: 229.48x

Average across the current suite: about 214.9x.

The conservative claim is still 100x+, because real-world speedups depend on payload shape, string density, and how broken the JSON is.

The full benchmark harness and development test setup live on the dev branch.

Development

Create the local environment and install the package in editable mode:

python3 -m venv .venv
.venv/bin/python -m pip install --upgrade pip maturin
.venv/bin/maturin develop

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

repairjson-0.1.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

repairjson-0.1.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (248.4 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

repairjson-0.1.1-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl (262.9 kB view details)

Uploaded PyPymanylinux: glibc 2.5+ i686

repairjson-0.1.1-cp38-abi3-win_arm64.whl (109.0 kB view details)

Uploaded CPython 3.8+Windows ARM64

repairjson-0.1.1-cp38-abi3-win_amd64.whl (108.7 kB view details)

Uploaded CPython 3.8+Windows x86-64

repairjson-0.1.1-cp38-abi3-win32.whl (104.0 kB view details)

Uploaded CPython 3.8+Windows x86

repairjson-0.1.1-cp38-abi3-musllinux_1_2_x86_64.whl (451.9 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ x86-64

repairjson-0.1.1-cp38-abi3-musllinux_1_2_i686.whl (484.1 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ i686

repairjson-0.1.1-cp38-abi3-musllinux_1_2_armv7l.whl (526.2 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARMv7l

repairjson-0.1.1-cp38-abi3-musllinux_1_2_aarch64.whl (419.8 kB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARM64

repairjson-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (249.5 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

repairjson-0.1.1-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (267.9 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ s390x

repairjson-0.1.1-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (362.4 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ppc64le

repairjson-0.1.1-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (250.8 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARMv7l

repairjson-0.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (243.5 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

repairjson-0.1.1-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl (263.5 kB view details)

Uploaded CPython 3.8+manylinux: glibc 2.5+ i686

repairjson-0.1.1-cp38-abi3-macosx_11_0_arm64.whl (217.9 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

repairjson-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl (218.6 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file repairjson-0.1.1.tar.gz.

File metadata

  • Download URL: repairjson-0.1.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for repairjson-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7947a1a44bd1dbc3e35ed7da7a84cc564891d14017a30bf2e86a5a4954bb28b5
MD5 4b63f46628e4f69f6d5f2009f4c109e6
BLAKE2b-256 7d7f73ff04f4a32777e1b038d067b6e879b7768bd41edbda9bfca807bc5c9fbe

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1.tar.gz:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repairjson-0.1.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for repairjson-0.1.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 22315c341633e156c563ae4b10c88b7beb0e515f2cadad3dd9f79df8e7d4325a
MD5 eb034177dc948890d1beaac16751b479
BLAKE2b-256 dfef9bf49a78acb0e07769ab312434a992e39a77412f665707370cd06f127142

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repairjson-0.1.1-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for repairjson-0.1.1-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 31bb43fe02df8fda9a515509226d09c79a6ee3f56e8147e916c706a7cfe93dca
MD5 e6abf6278902ac12d8485a82e4f2e0e0
BLAKE2b-256 1fef46c1183c133a32d7606c4da3070829923ac1694b1812f775cab4943471dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repairjson-0.1.1-cp38-abi3-win_arm64.whl.

File metadata

  • Download URL: repairjson-0.1.1-cp38-abi3-win_arm64.whl
  • Upload date:
  • Size: 109.0 kB
  • Tags: CPython 3.8+, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for repairjson-0.1.1-cp38-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 2106622298799d12c37e18dba1101891ea7a9353f70bcc3f8f84091f0cb8a87a
MD5 eb19e2c93dcdaf6f6a6f65e6cd15e987
BLAKE2b-256 70385c19ab3db8ae4ee3363ace1237cde3272ffcaa8cf216b2d2b31a184e8783

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1-cp38-abi3-win_arm64.whl:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repairjson-0.1.1-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: repairjson-0.1.1-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 108.7 kB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for repairjson-0.1.1-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 f07287687bea31425780fcfb66b8b7abd2c4108539b3e2b4fea1109cc385591b
MD5 9d21e1e93cf16d0668cc11a0aca2d74d
BLAKE2b-256 146deafafcda6ebac2a1db07c9e3385e3193a8528e1fa96a21a31f36f6bd416c

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1-cp38-abi3-win_amd64.whl:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repairjson-0.1.1-cp38-abi3-win32.whl.

File metadata

  • Download URL: repairjson-0.1.1-cp38-abi3-win32.whl
  • Upload date:
  • Size: 104.0 kB
  • Tags: CPython 3.8+, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for repairjson-0.1.1-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 5164511090a0aaded7e77d00bfc9caf890aecc885e617d30e58b8a439d7c8cb2
MD5 6a631a3f92833e74f5552bdbd7cb64e4
BLAKE2b-256 0db2ab425d639b57ce89b920ee95340210314377f811ce1b37b9d9a54c7783ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1-cp38-abi3-win32.whl:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repairjson-0.1.1-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for repairjson-0.1.1-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b9436e7ed315f5eeea3423caf9fb74abdf3eeb09341ccc7e3833376cc4234d16
MD5 f9a72a6be38550e44dd3ef6ff6acd5a7
BLAKE2b-256 11333cae04d9dde1918fe39a9dba3308c18ed34c32220db06b14c670181e7e8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1-cp38-abi3-musllinux_1_2_x86_64.whl:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repairjson-0.1.1-cp38-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for repairjson-0.1.1-cp38-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 594ffa28a9d782d9e9c723f0d559b07f4cfb2655139ca9ba29e84c37bd511a6e
MD5 6cc0d15302ef93f829f52e89fb7ec6f7
BLAKE2b-256 56d856fcd371c5dc85f4c0a2b9152fd06d627a25e48ac74772ac8b5ce2670f20

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1-cp38-abi3-musllinux_1_2_i686.whl:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repairjson-0.1.1-cp38-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for repairjson-0.1.1-cp38-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 71ad413f9b52f8e5a14b603ac10985bad3d096cecb882d600126a6d6dabf9f8b
MD5 101b6873f7e87550ca3dfaeedb79993c
BLAKE2b-256 988f8575441fdeb7c04dba118baa4e870e9d60f3d855a03b58a69bd4ac1df768

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1-cp38-abi3-musllinux_1_2_armv7l.whl:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repairjson-0.1.1-cp38-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for repairjson-0.1.1-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 3f3e915ef2ec8d28e4ac514d54d9e1f4826f2ebb690d2ee89b1eace21cfc5200
MD5 d8349404860b2c48d2bc2bcc938ce3ad
BLAKE2b-256 b986c79c1cf4866664479f226b369e84302a9441550c8a4cc676678602405304

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1-cp38-abi3-musllinux_1_2_aarch64.whl:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repairjson-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for repairjson-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1e5463d0710a180a7f33e483723331152febeac8e47ecc0c761e506b3637e263
MD5 c14014bde9c11bb1b271d83500f0c3ea
BLAKE2b-256 53e370ae9de5fafe05133931b193ab1d828ac3a1e0675e3dd3e562241f6085ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repairjson-0.1.1-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for repairjson-0.1.1-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 42812010b59f838a046b144146c2f2fd84f042fa546738abcd24605ba0756209
MD5 34e518c8772b2772aa32ccc64b414b40
BLAKE2b-256 c79211251a7f85f9c1aa40f9321505502c0ec4538cea028c7509382f8035e499

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repairjson-0.1.1-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for repairjson-0.1.1-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 bd57dca6d6467f93a1590ae346dfdd0c68af0e17f5f633e4ecc4cf218ffc8072
MD5 b1d76d3a4db8fb76f541d455360d80b9
BLAKE2b-256 e06fded1583d497dfb621d2571c196f63a009aea9e955f58be99f511255d39a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repairjson-0.1.1-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for repairjson-0.1.1-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 23c84fbd4d571f5d7ca0ad9e5e794f991f7ff30ea9ac78344b820c8c67324528
MD5 960d0e81c70f731523ceda341c9586b9
BLAKE2b-256 c923595d498f89b5b43e44ddae2bdf46c813213019e48206e7c88db2d7c1917b

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repairjson-0.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for repairjson-0.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c626d521eb932e1a8fdea17134f1c6fe4bd0073fe3c75c406678492cd4cbd556
MD5 e72ed566fe2f7a2db98f113a690db1d6
BLAKE2b-256 0fa6b5aafa54b71a10852972754658feb6c8f53f60556973b4a99943e8aa3b76

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repairjson-0.1.1-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for repairjson-0.1.1-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 45dc8ac0623319b49fd9d7e3f40717b72f8bbd3efe0cca2ab77cf8039a4122ca
MD5 0b418348c819123ffc4acd568be1f877
BLAKE2b-256 ebc5afedcccdf3beec416d3a8061e7e4b6187dc14e4c2cbd6e803715fc1d8b9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repairjson-0.1.1-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for repairjson-0.1.1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3af658e412d4b225ccfd365d51b281c7c8164360771d055debc770dcc49426fa
MD5 47a5cba7a0834a40ec8379ee280d1a48
BLAKE2b-256 5566ff468e4026185205f2c635646179aa0b08fb93cec8447728a9d4fb7f5fe8

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file repairjson-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for repairjson-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9e18a123ec4a43ab11ab336aee835166d50a6be6c94c1319e2a1a1fec7f7dc9f
MD5 4acc035689a1c3b4a00e0644d00b0fc3
BLAKE2b-256 30dbb5379cbefe11c45386348a6f3b05d712eb8d53467982fb29735351a70a05

See more details on using hashes here.

Provenance

The following attestation bundles were made for repairjson-0.1.1-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: CI.yml on kyle-mirich/repairjson

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page