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 (Apr 30, 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.62x 4.17x 1.06x 1.00x 1.82 μs
List of 256 ASCII strings 14.09x 8.10x 1.66x 1.00x 3.66 μs
List of 256 floats 25.20x 25.18x 1.33x 1.00x 8.07 μs
List of 256 dicts with 1 int 11.24x 9.89x 1.34x 1.00x 7.87 μs
Medium complex object 10.21x 8.85x 1.17x 1.00x 13.87 μs
List of 256 strings 26.46x 15.18x 2.23x 1.00x 13.37 μs
Complex object 7.86x 7.41x 1.00x DNF 207.83 μs
Dict with 256 lists of 256 dicts with 1 int 9.87x 8.72x 1.24x 1.00x 2295.24 μs
decode json jsonyx msgspec orjson simdjson fastest time
List of 256 booleans 4.70x 5.22x 2.92x 1.41x 1.00x 1.45 μs
List of 256 ASCII strings 9.04x 7.05x 4.85x 4.43x 1.00x 3.15 μs
List of 256 floats 10.91x 11.22x 2.24x 1.73x 1.00x 6.14 μs
List of 256 dicts with 1 int 12.99x 11.65x 7.35x 5.30x 1.00x 6.11 μs
Medium complex object 13.41x 12.94x 5.44x 4.67x 1.00x 7.65 μs
List of 256 strings 6.85x 3.75x 9.56x 7.85x 1.00x 16.78 μs
Complex object 9.36x 7.63x 8.55x 7.67x 1.00x 136.11 μs
Dict with 256 lists of 256 dicts with 1 int 19.03x 15.62x 11.58x 9.87x 1.00x 1640.77 μ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.3.0.tar.gz (67.0 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.3.0-cp313-cp313-macosx_13_0_x86_64.whl (80.7 kB view details)

Uploaded CPython 3.13macOS 13.0+ x86-64

File details

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

File metadata

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

File hashes

Hashes for jsonyx-2.3.0.tar.gz
Algorithm Hash digest
SHA256 77b14b32aaf1f2f77b997114d8dcaebd91885b7562b0718687e4e571ddbfb762
MD5 6a1d1b00faf3f75c4ec0150b067c3e0d
BLAKE2b-256 2c4f1313dfff01b72c0c6b446406878f4b14c071913782c4187a437f51475fed

See more details on using hashes here.

File details

Details for the file jsonyx-2.3.0-cp313-cp313-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for jsonyx-2.3.0-cp313-cp313-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 69a36b0de89b7e53c152635a5435d3d1dd09b22c1777a67ac006f8ac5473e38c
MD5 0215740e8b0824305d9627e97d31b9af
BLAKE2b-256 5fdda242df928de8fdf7defde183c646d0f878605733d472804829343e4641bf

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