Skip to main content

JSON5 parser for Python written in C.

Project description

📎 Quick JSON5 (qjson5)

A quick JSON5 implementation written in C, with Python bindings.

Install

pip install qjson5

Usage

import qjson5

data = {
    "key": "value",
    "array": [1, 2, 3],
    "object": {
        "nested": "value"
    }
}

encoded = qjson5.dumps(data)
print(f"Encoded: {encoded}")

decoded = qjson5.loads(encoded)
print(f"Decoded: {decoded}")

Complex Usage

{
  // comments
  unquoted: 'and you can quote me on that',
  singleQuotes: 'I can use "double quotes" here',
  lineBreaks: "Look, Mom! \
No \\n's!",
  hexadecimal: 0xdecaf,
  leadingDecimalPoint: .8675309, andTrailing: 8675309.,
  positiveSign: +1,
  trailingComma: 'in objects', andIn: ['arrays',],
  "backwardsCompatible": "with JSON",
}
import qjson5

with open("in.json5") as f_in:
    with open("out.json", "w") as f_out:
        qjson5.dump(qjson5.load(f_in), f_out, indent=4)
{
    "unquoted": "and you can quote me on that",
    "singleQuotes": "I can use \"double quotes\" here",
    "lineBreaks": "Look, Mom! No \\n's!",
    "hexadecimal": 912559,
    "leadingDecimalPoint": 0.8675309,
    "andTrailing": 8675309,
    "positiveSign": 1,
    "trailingComma": "in objects",
    "andIn": [
        "arrays"
    ],
    "backwardsCompatible": "with JSON"
}

Benchmark

Comparing with the other JSON5 libraries:

Non-JSON5 library:

==== JSON Libraries Dump+Load Benchmark ====

--- Data Set: SMALL (10 keys per level, 2 levels) ---
json5        => avg: 5274.9761 ms (std: 74.0018 ms) over 1000 iterations
builtin-json => avg: 14.1933 ms (std: 0.5063 ms) over 1000 iterations
pyjson5      => avg: 11.7564 ms (std: 0.1826 ms) over 1000 iterations
qjson5       => avg: 8.4363 ms (std: 0.0669 ms) over 1000 iterations

--- Data Set: MEDIUM (100 keys per level, 10 levels) ---
json5        => Skipped
builtin-json => avg: 150.4009 ms (std: 1.8448 ms) over 500 iterations
pyjson5      => avg: 147.5031 ms (std: 0.8454 ms) over 500 iterations
qjson5       => avg: 98.7803 ms (std: 0.3422 ms) over 500 iterations

--- Data Set: LARGE (1000 keys per level, 50 levels) ---
json5        => Skipped
builtin-json => avg: 150.6014 ms (std: 3.4461 ms) over 10 iterations
pyjson5      => Error: Maximum nesting level exceeded near 4642
qjson5       => avg: 99.5796 ms (std: 0.9641 ms) over 10 iterations

See scripts/benchmark.py for benchmarking details.

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

qjson5-1.0.3.tar.gz (13.0 kB view details)

Uploaded Source

Built Distributions

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

qjson5-1.0.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (23.6 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

qjson5-1.0.3-pp311-pypy311_pp73-macosx_11_0_arm64.whl (18.7 kB view details)

Uploaded PyPymacOS 11.0+ ARM64

qjson5-1.0.3-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (23.6 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

qjson5-1.0.3-pp310-pypy310_pp73-macosx_11_0_arm64.whl (18.6 kB view details)

Uploaded PyPymacOS 11.0+ ARM64

qjson5-1.0.3-cp313-cp313-musllinux_1_2_x86_64.whl (57.7 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

qjson5-1.0.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (59.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

qjson5-1.0.3-cp313-cp313-macosx_11_0_arm64.whl (18.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

qjson5-1.0.3-cp312-cp312-musllinux_1_2_x86_64.whl (57.6 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

qjson5-1.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (59.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

qjson5-1.0.3-cp312-cp312-macosx_11_0_arm64.whl (18.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

qjson5-1.0.3-cp311-cp311-musllinux_1_2_x86_64.whl (56.9 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

qjson5-1.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (58.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

qjson5-1.0.3-cp311-cp311-macosx_11_0_arm64.whl (18.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

qjson5-1.0.3-cp310-cp310-musllinux_1_2_x86_64.whl (56.2 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

qjson5-1.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (58.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

qjson5-1.0.3-cp310-cp310-macosx_11_0_arm64.whl (18.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file qjson5-1.0.3.tar.gz.

File metadata

  • Download URL: qjson5-1.0.3.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for qjson5-1.0.3.tar.gz
Algorithm Hash digest
SHA256 b5bdfec19d5ef03528313c9727a62afc454d0108b251caf743a23a5f342cc219
MD5 c3094595105b018d74c8799dac78361a
BLAKE2b-256 a61528e7b547d0d1cdbbb784bf2ae3879db39eaa19dbf8da26d99aadaba89697

See more details on using hashes here.

Provenance

The following attestation bundles were made for qjson5-1.0.3.tar.gz:

Publisher: release.yaml on qvecs/qjson5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qjson5-1.0.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qjson5-1.0.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2a7058bc83d29031b5f45bcfda7c3810c426a0331513e42efe2e0b280e48c35e
MD5 55cf670f4a4b938f8d50956754d57113
BLAKE2b-256 f87516aac01aeaa042d32e2b6f558932a6df32bef7b956e9f0397cf16eec36ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for qjson5-1.0.3-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yaml on qvecs/qjson5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qjson5-1.0.3-pp311-pypy311_pp73-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qjson5-1.0.3-pp311-pypy311_pp73-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c4725ede65c55036faf55185af5ca29fb293fc65d8c8d1b913704d3ee8f03724
MD5 ee76f991a458afb9b0108e37dba2ba21
BLAKE2b-256 ebf9019b720ad4ebf0130b9640d26c243445ef7a5036565c412ada5ff232aecc

See more details on using hashes here.

Provenance

The following attestation bundles were made for qjson5-1.0.3-pp311-pypy311_pp73-macosx_11_0_arm64.whl:

Publisher: release.yaml on qvecs/qjson5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qjson5-1.0.3-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qjson5-1.0.3-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ab7fdd89d80beb36691349dd52a80bcefce7c58d71c1acc061c2d4f1bf9c1c0a
MD5 e22a64a7c4503993f91866a69be6c730
BLAKE2b-256 cfb320b76d1696d4bc4c78769e3a2ec73f16cd9dee16c984c7ffaecce4bf79c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for qjson5-1.0.3-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yaml on qvecs/qjson5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qjson5-1.0.3-pp310-pypy310_pp73-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qjson5-1.0.3-pp310-pypy310_pp73-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cbcabc66bb8f552064d0d98fe2ae8012064d0604b67c870a250fedf139a7e27e
MD5 4c8c9780ccc60a13224e74d4388f21d1
BLAKE2b-256 0485de66318a85c1e812a8cd43defc754eb1f87ad4fc03d6b5ddce594ad1a8d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for qjson5-1.0.3-pp310-pypy310_pp73-macosx_11_0_arm64.whl:

Publisher: release.yaml on qvecs/qjson5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qjson5-1.0.3-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for qjson5-1.0.3-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0c9798f8bcf3d4778032a4c6a8ee6b33f713bea515da5f0c3b8f15a4188530f0
MD5 a747dca1443686c4c51f6d8ccbf21f2a
BLAKE2b-256 60e86d9cde2262738fb8984af8d663105e2c7b4b216991d41bc446294b742bb2

See more details on using hashes here.

Provenance

The following attestation bundles were made for qjson5-1.0.3-cp313-cp313-musllinux_1_2_x86_64.whl:

Publisher: release.yaml on qvecs/qjson5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qjson5-1.0.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qjson5-1.0.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 49eeb9ccfc58821ff26abeab68e8d9fdf95c5001450fdd8ad69831a98574b0b5
MD5 914fdc4bd20a0cfeba28d37676587b46
BLAKE2b-256 074b4e8b59d3e56c60ae4562db1372b50ad7ac5ba01dcf9e868ad02c19818309

See more details on using hashes here.

Provenance

The following attestation bundles were made for qjson5-1.0.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yaml on qvecs/qjson5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qjson5-1.0.3-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qjson5-1.0.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7652144a0ac51e37cdc5a8e0f828b5673558a029e84a3620ade3708315aea8b2
MD5 ea011a448152c49fa153664e65f2ca97
BLAKE2b-256 f478b3adaf4195ae5184d80ea93e4f1873524ed6494ad0501bd79376575e9d98

See more details on using hashes here.

Provenance

The following attestation bundles were made for qjson5-1.0.3-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yaml on qvecs/qjson5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qjson5-1.0.3-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for qjson5-1.0.3-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5171cd538383235949732d6f3a7282cd63b4504bbfdf861bb8323291d0717360
MD5 957505e30e2ce54342b486405788da84
BLAKE2b-256 021bb5756be6c2f2ff9f0bd23ae6008991883663b52b735647e73f3050837fd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for qjson5-1.0.3-cp312-cp312-musllinux_1_2_x86_64.whl:

Publisher: release.yaml on qvecs/qjson5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qjson5-1.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qjson5-1.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4f9c26fa1af313a7fb523035ad30f30a83adf2d4e9c11dff6e587f2bbdd4fd62
MD5 a71cac302f0a8258cfe6490967443efe
BLAKE2b-256 80f68f5f16d9f2cf17a0978b5aeb042579089b2c33d6b355ee838f3b9d8f08b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for qjson5-1.0.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yaml on qvecs/qjson5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qjson5-1.0.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qjson5-1.0.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9a21c273397d32950ef74ef32a0b0860fef6289f3dd68139ac06d8e1a3e0168a
MD5 f25b2d77539b9a78bd507a3b932895bc
BLAKE2b-256 b15c027596eba75eb1ca3a96ae3096ad7027bbddbe704f3b7f13c8e5da0881cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for qjson5-1.0.3-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yaml on qvecs/qjson5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qjson5-1.0.3-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for qjson5-1.0.3-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 beca36914ae0d096f5a9e2028025fa32dfe2848b22a5d6e6169d7e4326363db3
MD5 048ef76f13c54a510d714c0cc768b7a0
BLAKE2b-256 92e390c04eb772eaa0ebcedda2931348ef1fcfc80c82686e827b3c6ac103c2d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for qjson5-1.0.3-cp311-cp311-musllinux_1_2_x86_64.whl:

Publisher: release.yaml on qvecs/qjson5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qjson5-1.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qjson5-1.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cd2682643da8d593087301a8edc367817fb7777ff58925e87df62c12df8ab44c
MD5 0cef053194125058cda2bd6fed09a704
BLAKE2b-256 3a355165bd8df7387b75424b1d941d901d87343a6489c38c1189038b5c9d303a

See more details on using hashes here.

Provenance

The following attestation bundles were made for qjson5-1.0.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yaml on qvecs/qjson5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qjson5-1.0.3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qjson5-1.0.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 533fae38915c5e353cb3c28dca83b1ace3357359555de7833b0c56d8d06eddf2
MD5 3f02cc75a1ffe8382804215408b1167f
BLAKE2b-256 8abc9a1b2ac7d360d499eb7303383250d9b5f368d5ef3494538c921abb11d146

See more details on using hashes here.

Provenance

The following attestation bundles were made for qjson5-1.0.3-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yaml on qvecs/qjson5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qjson5-1.0.3-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for qjson5-1.0.3-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 41629b34dbc4679a4669c16d90bf35464c66d9fea6ab740b1f65e28b7ad81b45
MD5 55d27b7c03e90f45ba8cc1c75cf33013
BLAKE2b-256 654af4ffe02366049439c4e5fbaf86c67ed8f7dbbf76a9e7b6b6e315923f60c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for qjson5-1.0.3-cp310-cp310-musllinux_1_2_x86_64.whl:

Publisher: release.yaml on qvecs/qjson5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qjson5-1.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qjson5-1.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5ab42f284bc05abf84dd8f70227dc53324fcd011c7d057a94646f313556c9c8f
MD5 75637e3150683a4548c5474a9d161240
BLAKE2b-256 4d69a7e65f13604ee44687b6a131b338305cfe028005ccd02e09732ad46321af

See more details on using hashes here.

Provenance

The following attestation bundles were made for qjson5-1.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yaml on qvecs/qjson5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qjson5-1.0.3-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qjson5-1.0.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 750a72e00e81736fbaf046750cca094ca8090d1bb839d5c6a654824d06e95542
MD5 a859da3a45a45e30a86324969b76bae2
BLAKE2b-256 a7d1c6c2a6c020761bad1d766056c58d79e5fe584dd69d1d9ac1ce4d45d77551

See more details on using hashes here.

Provenance

The following attestation bundles were made for qjson5-1.0.3-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: release.yaml on qvecs/qjson5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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