Skip to main content

cujson

Parse JSON and JSON Lines on an NVIDIA GPU from Python, using the cuJSON parser (ASPLOS '26) packaged by cuJSON-rs.

pip install cujson

Requirements

  • Linux x86_64, Python 3.10 or newer
  • An NVIDIA GPU of compute capability 7.5 or newer (Turing onwards)
  • An NVIDIA driver that supports CUDA 13 (R580 or newer)

The wheel links the CUDA runtime statically, so the driver is the only CUDA component you need to install. On a CUDA 12 system, build from a checkout with pip install ./crates/cujson-py.

Usage

import cujson

doc = cujson.parse('{"user": {"name": "Ada", "langs": ["en", "fr"]}}')
doc.to_python()                  # {'user': {'name': 'Ada', 'langs': ['en', 'fr']}}
doc.pointer("/user/langs/1")     # 'fr'  (RFC 6901 JSON Pointer)

lines = cujson.parse_lines('{"id": 1}\n{"id": 2}\n')
lines.to_python()                # [{'id': 1}, {'id': 2}]
lines.pointer("/1/id")           # 2  (the first token selects the line)
len(lines)                       # 2

cujson.parse_file("data.json")   # read and parse a file
cujson.cuda_info()               # runtime, driver, compiled architectures, devices
cujson.trim_pinned_cache()       # release the pinned buffer kept between parses

parse and parse_lines accept str, bytes, bytearray or memoryview. The GIL is released while the GPU parses.

Errors

All exceptions derive from cujson.CujsonError:

Exception Also a Raised when
InvalidUtf8Error ValueError the input is not valid UTF-8
UnbalancedError ValueError brackets or braces do not match
InputError ValueError the input is empty, too large, or (for parse) not exactly one JSON value
CudaError RuntimeError CUDA is unusable, e.g. no driver or a driver too old for CUDA 13
NoDeviceError CudaError the driver reports no visible GPU

Limitations

  • cuJSON checks UTF-8 validity and bracket balance, not the full JSON grammar: malformed scalars such as 1.2.3 are not rejected.
  • Inputs are limited to just under 2 GiB (cuJSON uses 32-bit sizes).
  • Parses are serialised within a process: cuJSON uses the default CUDA stream.
  • After a parse, dropping its Document keeps at most one tape-sized pinned host buffer (roughly a third of the input size) allocated so the next parse can reuse it. It is released by cujson.trim_pinned_cache() or when the process exits.

Credits

cuJSON is by Ashkan Vedadi Gargary, Soroosh Safari Loaliyan and Zhijia Zhao (MIT licensed). If you use it in research, cite CuJSON: A Highly Parallel JSON Parser for GPUs (ASPLOS '26). cuJSON-rs is MIT licensed.

Release files for cujson 0.1.2

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

Built distribution (wheel)

Table of built distributions (wheels) for cujson 0.1.2
File Interpreter ABI Platform
cujson-0.1.2-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details

Release files / cujson-0.1.2-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL cujson-0.1.2-cp310-abi3-manylinux_2_28_x86_64.whl
Size 4.7 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
fa5f3bb1ec125efef895f8cc78462ad399adbac66679d6007a08671ae1d8a990
BLAKE2b-256 checksum
How to use checksums
9aaf97406f1458d84022a376b48484991fe2529fb44695912afa191af4682d62
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 Sep 23, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.3

1 release file

This release

0.1.2 This release

1 release file

0.1.1

1 release file

0.1.0

1 release file

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