Skip to main content

Customizable JSON library for Python

Project description

jsonyx

pypi conda-forge python license pytest docs downloads

jsonyx is a customizable JSON library for Python 3.8+. It is written in pure Python with an optional C extension for better performance and no dependencies.

The documentation for jsonyx is available online at: https://jsonyx.readthedocs.io

Key Features

  • JSON decoding, encoding and patching
  • Pretty printing:
    {
        "foo": [1, 2, 3],
        "bar": {"a": 1, "b": 2, "c": 3}
    }
    
  • Optionally supports these JSON deviations (specified in the documentation):
    {
        /* Block */ // and line comments
        "Missing commas": [1 2 3],
        "NaN and infinity": [NaN, Infinity, -Infinity],
        "Surrogates": "\ud800",
        "Trailing comma": [0,],
        "Unquoted keys": {key: "value"}
    }
    
  • Detailed error messages:
    Traceback (most recent call last):
      File "/Users/wannes/Downloads/broken.json", line 1, column 99-381
        ...sList": {"GlossEntry": {"ID": "SGM..."GML", "XML"]}, "GlossSee": "markup"
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    jsonyx.JSONSyntaxError: Unterminated object
    
  • Dedicated functions for reading and writing files and pretty printing

Benchmark (Mar 31, 2025)

We recommend to use orjson, msgspec or pysimdjson for performance critical applications:

encode json jsonyx msgspec orjson fastest time
List of 256 booleans 4.56x 5.33x 1.00x 1.06x 1.90 μs
List of 256 ASCII strings 12.12x 13.65x 1.50x 1.00x 3.95 μs
List of 256 floats 23.41x 25.95x 1.30x 1.00x 8.03 μs
List of 256 dicts with 1 int 11.10x 13.61x 1.32x 1.00x 7.75 μs
Medium complex object 10.76x 11.80x 1.16x 1.00x 13.30 μs
List of 256 strings 23.08x 19.66x 2.04x 1.00x 14.42 μs
Complex object 7.36x 7.95x 1.00x DNF 209.74 μs
Dict with 256 lists of 256 dicts with 1 int 9.23x 11.34x 1.21x 1.00x 2361.90 μs
decode json jsonyx msgspec orjson simdjson fastest time
List of 256 booleans 4.40x 6.26x 2.60x 1.28x 1.00x 1.54 μs
List of 256 ASCII strings 9.08x 12.57x 5.43x 5.03x 1.00x 2.89 μs
List of 256 floats 10.99x 12.47x 2.32x 1.78x 1.00x 6.14 μs
List of 256 dicts with 1 int 12.11x 15.16x 6.87x 5.08x 1.00x 6.17 μs
Medium complex object 12.65x 17.63x 5.26x 4.40x 1.00x 7.62 μs
List of 256 strings 5.68x 4.38x 9.92x 8.00x 1.00x 16.76 μs
Complex object 8.58x 7.54x 8.32x 7.56x 1.00x 136.79 μs
Dict with 256 lists of 256 dicts with 1 int 17.65x 19.13x 12.07x 10.78x 1.00x 1658.37 μs

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

jsonyx-2.2.0.tar.gz (67.6 kB view details)

Uploaded Source

Built Distribution

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

jsonyx-2.2.0-cp313-cp313-win_amd64.whl (80.8 kB view details)

Uploaded CPython 3.13Windows x86-64

File details

Details for the file jsonyx-2.2.0.tar.gz.

File metadata

  • Download URL: jsonyx-2.2.0.tar.gz
  • Upload date:
  • Size: 67.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for jsonyx-2.2.0.tar.gz
Algorithm Hash digest
SHA256 806a9adee934afa0cc676811f358f5fe6c7b553b3fd4b48b6cacaacebea4af9d
MD5 1f94d1054ddcf1e7ea17d677c75b08be
BLAKE2b-256 4535ee14098f5517e2123faf08bf26a0622116dd09a7ab7d0100051d34cc8c60

See more details on using hashes here.

File details

Details for the file jsonyx-2.2.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: jsonyx-2.2.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 80.8 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for jsonyx-2.2.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 30598fcc7819a6320d7a0f414a0092983cd379d2f57cc6de0a7f718d6d7d658e
MD5 894364d93dc90b770b6a673b052135b1
BLAKE2b-256 ba1c493c8fb1b66f0f67bf06fa263f011cc7b3d7f4f8b47fa3fed897bb1d5a38

See more details on using hashes here.

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