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 17, 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.69x 5.64x 1.00x 1.04x 1.92 μs
List of 256 ASCII strings 13.08x 15.03x 1.62x 1.00x 3.67 μs
List of 256 floats 24.38x 24.69x 1.35x 1.00x 7.89 μs
List of 256 dicts with 1 int 11.34x 14.32x 1.35x 1.00x 7.67 μs
Medium complex object 10.64x 12.05x 1.15x 1.00x 13.38 μs
List of 256 strings 21.28x 15.85x 1.95x 1.00x 15.16 μs
Complex object 7.14x 7.65x 1.00x DNF 213.74 μs
Dict with 256 lists of 256 dicts with 1 int 9.03x 11.34x 1.14x 1.00x 2423.70 μs
decode json jsonyx msgspec orjson simdjson fastest time
List of 256 booleans 4.65x 7.19x 3.02x 1.41x 1.00x 1.43 μs
List of 256 ASCII strings 7.35x 12.65x 4.73x 4.42x 1.00x 2.98 μs
List of 256 floats 10.85x 12.17x 2.16x 1.66x 1.00x 6.10 μs
List of 256 dicts with 1 int 13.56x 16.11x 6.92x 5.24x 1.00x 6.17 μs
Medium complex object 12.47x 18.84x 5.25x 4.34x 1.00x 7.68 μs
List of 256 strings 4.01x 3.41x 14.99x 8.04x 1.00x 23.47 μs
Complex object 8.92x 7.75x 9.09x 9.16x 1.00x 145.17 μs
Dict with 256 lists of 256 dicts with 1 int 17.95x 22.36x 12.42x 10.53x 1.00x 1621.17 μ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.0.0.post2.tar.gz (66.1 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.0.0.post2-cp313-cp313-win_amd64.whl (79.5 kB view details)

Uploaded CPython 3.13Windows x86-64

File details

Details for the file jsonyx-2.0.0.post2.tar.gz.

File metadata

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

File hashes

Hashes for jsonyx-2.0.0.post2.tar.gz
Algorithm Hash digest
SHA256 3717edb6dd6b0db365b8983d74999f36de3e0a38fc82313b8495594d3a8d6a03
MD5 8e363828abfc5e61e32456897ba69fbb
BLAKE2b-256 407fd2f42cbe11b2148868c637ec20c201225da499a4151cfee2b62997a02630

See more details on using hashes here.

File details

Details for the file jsonyx-2.0.0.post2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for jsonyx-2.0.0.post2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1214baac55093c5a2ca7a1837fbb628d478f76744dba68cac6e87541e9a6ac65
MD5 18f71de031838099ddf7c6fc9527dc0f
BLAKE2b-256 02144193d796adb8ae8f00bbb1af0504b0d2756e02b981c345982fde35bb7fea

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