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 20, 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.54x 4.06x 1.04x 1.00x 1.85 μs
List of 256 ASCII strings 11.76x 10.42x 1.33x 1.00x 4.34 μs
List of 256 floats 24.82x 25.10x 1.30x 1.00x 8.09 μs
List of 256 dicts with 1 int 11.10x 11.50x 1.34x 1.00x 7.92 μs
Medium complex object 10.25x 11.05x 1.14x 1.00x 13.77 μs
List of 256 strings 22.19x 17.00x 1.86x 1.00x 15.81 μs
Complex object 7.54x 7.41x 1.00x DNF 215.37 μs
Dict with 256 lists of 256 dicts with 1 int 9.34x 9.74x 1.29x 1.00x 2394.91 μs
decode json jsonyx msgspec orjson simdjson fastest time
List of 256 booleans 4.36x 5.26x 2.76x 1.40x 1.00x 1.46 μs
List of 256 ASCII strings 8.54x 6.93x 4.28x 3.96x 1.00x 3.46 μs
List of 256 floats 10.85x 11.25x 2.23x 1.74x 1.00x 6.05 μs
List of 256 dicts with 1 int 12.79x 11.43x 7.12x 5.19x 1.00x 6.12 μs
Medium complex object 12.70x 12.01x 5.16x 4.60x 1.00x 7.98 μs
List of 256 strings 7.11x 3.82x 9.70x 7.80x 1.00x 16.52 μs
Complex object 9.87x 7.74x 8.90x 7.94x 1.00x 130.28 μs
Dict with 256 lists of 256 dicts with 1 int 17.84x 15.18x 12.08x 10.32x 1.00x 1674.28 μ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.1.tar.gz (67.2 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.1-cp313-cp313-win_amd64.whl (81.0 kB view details)

Uploaded CPython 3.13Windows x86-64

File details

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

File metadata

  • Download URL: jsonyx-2.2.1.tar.gz
  • Upload date:
  • Size: 67.2 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.1.tar.gz
Algorithm Hash digest
SHA256 b1fed1a8e7de20f9d3a5752d36e866e6ca0eefb00f46e8fb8a924d9e97db755e
MD5 6096469aef415d4a7dd78815400fc953
BLAKE2b-256 bce25f6648cd34b35be286fb213b83994d4218be2894a0df3de63d7a826bc5d2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsonyx-2.2.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 81.0 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.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 be30fc498c82667f111a6f0a7dbebf358dc5526f8af47e018511902c50897f6f
MD5 bb49e3fb5e5321c4bbffe16d0f9fd230
BLAKE2b-256 607076669b4bbf5ada4389604c051853dcaabd1e046fe4f0b33393311466adf5

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