Skip to main content

Rust-backed JSON comment and trailing comma stripper

Project description

json-comments

A Rust-backed JSON comment and trailing comma stripper for Python.

json-comments provides a single, simple utility to clean JSON-like strings before parsing them. It removes C-style (//), block (/* */), and shell-style (#) comments, as well as trailing commas from objects and arrays.

Installation

pip install json-comments

Usage

import json
import json_comments

raw_data = """
{
    "foo": "bar", // c-style comment
    "baz": "qux", # shell-style comment
    "key": "value", /* block comment */
    "number": 123, // trailing comma
}
"""

# Strip comments and commas with `json_comments`
clean_json = json_comments.strip_json(raw_data)

# Parse with a JSON parser (e.g., `json` from the standard library)
data = json.loads(clean_json)
print(data)
# {'foo': 'bar', 'baz': 'qux', 'key': 'value', 'number': 123}

Acknowledgements

This project is a Python wrapper around the json-strip-comments Rust crate (a fork of the original json-comments-rs).

Special thanks to:

License

MIT. See LICENSE for details including upstream copyright notices.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

json_comments-0.1.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (239.7 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

json_comments-0.1.0-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (231.6 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

json_comments-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (232.0 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

json_comments-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (231.8 kB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

json_comments-0.1.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (230.1 kB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.17+ ARM64

json_comments-0.1.0-cp313-cp313-win_amd64.whl (100.9 kB view details)

Uploaded CPython 3.13Windows x86-64

json_comments-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (238.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

json_comments-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (230.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

json_comments-0.1.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (407.5 kB view details)

Uploaded CPython 3.13macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

json_comments-0.1.0-cp312-cp312-win_amd64.whl (100.9 kB view details)

Uploaded CPython 3.12Windows x86-64

json_comments-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (238.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

json_comments-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (229.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

json_comments-0.1.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (407.6 kB view details)

Uploaded CPython 3.12macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

json_comments-0.1.0-cp311-cp311-win_amd64.whl (100.8 kB view details)

Uploaded CPython 3.11Windows x86-64

json_comments-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (239.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

json_comments-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (231.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

json_comments-0.1.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (411.4 kB view details)

Uploaded CPython 3.11macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

json_comments-0.1.0-cp310-cp310-win_amd64.whl (101.0 kB view details)

Uploaded CPython 3.10Windows x86-64

json_comments-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (239.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

json_comments-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (231.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

json_comments-0.1.0-cp39-cp39-win_amd64.whl (100.9 kB view details)

Uploaded CPython 3.9Windows x86-64

json_comments-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (239.7 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

json_comments-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (231.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

json_comments-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (239.3 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

json_comments-0.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (230.9 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ ARM64

json_comments-0.1.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (230.9 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ ARM64

File details

Details for the file json_comments-0.1.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a544955e4099d2a3f5b81140a5dd48bfc191b9fe5a7f9f0d09d207414591a091
MD5 cb03d372699b8399d0d7e5cab5ad7705
BLAKE2b-256 0d903da91d960b5cfb674340d88a2d948888cfdf31fa9d95245dba786717d4ab

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 09bcb13e277eac0e92d8ee17815b5353091adf8f0d4fd2899bb9f2c44650eb8a
MD5 5f89e197d52b037ce010f00b2a50b45e
BLAKE2b-256 5f9f814146a178a4c0136e4c54af307cc10da771158efce5ed4cc11b42e1751b

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 db7c8a720ca9b2b29f1fe776666407888577f8567b4f98ab43e87dde442a7f24
MD5 7263509bc11d4f6c50d5faec88f86f39
BLAKE2b-256 64d491f6e8434ec0854c5d2c9c9736934476bc31654450af7658a37d0ddd6e83

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 47a72a78377937c5b883e0c60bf07a95bb1dbd31eecea12608c1aa382a341a8c
MD5 a36f3bfbd070579acb2bd7e3122463cf
BLAKE2b-256 27ae5c6e1230d203e308315e07d6442af9815684e741c73343cab1d1795f8efc

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8a99a519f43ea78e1e9ade8da2d82c58a944bae319a07bbfe01be25eea5f83ac
MD5 0892190774f1d4e54c33bed9abea357b
BLAKE2b-256 81f9d37c216568f01070aa119179d3cb65c7bae543697907632b8a2beed266c2

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 c78a86dd6680a193b561e12f9a7fc05307ec8a6aedbcc4d9b2536b0efaeb17c4
MD5 c5a229fb72b684f92fa0f0fa3f0d01b4
BLAKE2b-256 1359da92e0f2842661181b29f53bf69b555ae93ea7783f14c8421f58ef602c45

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cf11dcd3fc5c588bca5bea063de4104987d92b455dd2e85c007399946eadeb66
MD5 0ec943b6a038b3596ab9b38e4e27b40c
BLAKE2b-256 ee2108b5a90514c56b6029ff2832e44e033a1c6aab7d94af82ccb3374f2427bb

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 59707beeb2fe995bb95d0655e5126fc43071c939a9bb53cab41b0b8056703d9a
MD5 47612f6e94ea1ec711485894a576d1e4
BLAKE2b-256 b4576f73d6520fdee921520c53cbfe731be4d042614ddd43e3b0da88d887067f

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 435881a51141aff9b45c45516294fc18b48419dc1022ceb40b229869ea346b47
MD5 ee7f3bc073f1c9527169d36f9158e81d
BLAKE2b-256 bab61eb7f734e268f927ae163ca2a910ce0af08e1c9b4f428acbaba22c884db5

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 acb0aad1600a735d4b1566997524d7cf92e24ce18fb1b99dff7c03aeaf9f8950
MD5 b8df1bcbe99d502809c5df85421fdcae
BLAKE2b-256 8b4d342e1823f8129f48d6634f2d7a7203234d830129bd13817088608d609978

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3caeb00cda36654974130ab3dc468793f06f821cce07e31ba9e633adc4764770
MD5 e02dd7d2e9443f1ddd9d795439b2aaf5
BLAKE2b-256 8cf425cc8a3567e6bc1ed8170cf4dc605e624599cfc621fa83bbae9b795b3720

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 52b75218f2b4270199508a7d72495e501c73cc6631e4206bda71029d21ee34f5
MD5 0bfaa23b6a1d36b11f9f9be4e3beab4a
BLAKE2b-256 b816920514838a5bc7a94b31326508a383bc759958abca8182c40b4ea0244e20

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 6e9554d12b09336e2891f9a427eb2ee7597ef6731a38aa9089fbb85cc2c337e0
MD5 f1446957a6507d21c48203eebec88b2e
BLAKE2b-256 7e30d9e651bcd5415d535e357e2f81b67c41d812c41862ff1ae0cb7e8a8862fa

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5cc8a1fbbfaf24cb1f4ef7ac8d85e7fe12894c0c2dd91a1e1b47c2246e5b4150
MD5 2a61018e0ed2cf86fb4fd038ece16c30
BLAKE2b-256 b2c088d31e20ad4aea4a68edec1f552cf2c7fdbf7075ba03abc2755520f46eaf

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 697a503d6e8bd24386d747711affecb202e66152b7698b342f25b69c48f27424
MD5 3f756b84a70dab037cbe7b9f349d3fa1
BLAKE2b-256 03fdea5d8d17bef5b5adeecda0f2cc82139c939de34e1a5f97286393e5571ffd

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 90e9c613081c98f2f31c0776b68b61bc764c30966988e92db068d8009c4379d8
MD5 4b90da4745d15ec221ed3fd9e0094cd4
BLAKE2b-256 19f693aca27dd25d25429428004c1134176e6ec41284d834e6dc71356c4e690c

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 3c988285aefae189179052ffe25efcc52f0c07e5edab4086130720ee4cde1035
MD5 8de3df90bdd300d63856b27d3ad81c88
BLAKE2b-256 f365df7f63b558aa8b51eeb94ae8cea235ce45dfd5570e51d6712c75d9745771

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 33177ac8b58bf77ca905ca0b943341c8a8caf695d243fa5c39c85c925ab23295
MD5 a66fd9f68106cbe65cdfee5a40a83300
BLAKE2b-256 4b63be4b00844d14acf3c506d5a818f0655fb298c574a452117c84ef719a80c2

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 45608e50f03893a4591d568339be7326342349aeae87aaae1d6908827e1bdc7d
MD5 91a7cb50b7a792a21a0f82c90aab7df6
BLAKE2b-256 863feead8f43290f41d67f99f7d80d0a854ad5de6da1e9d132b7a70f5d691aeb

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6e8647318e60b6b8ec80008c6ff9f337b5f85da2ea1c03f542597e4156309c63
MD5 d0988131aa0ca0ae279c5d24cf98918d
BLAKE2b-256 300c968df0f69a4f991b31e2437dc624a23673710e7c9189befe3d11f5c23c38

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4579d9accc1312429d3c670b5d38ae450fba56e5db59c7893229eb29d90ba201
MD5 bf64a57d5da8effce23134fe9b4bcb57
BLAKE2b-256 732980ad21166797b0533185986660d68f3238be7797d3dfca1bf8178f4fea4c

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e9e98cbd483233a1a8485de051c0abc1d7ee3200d85f4e32ad3b7abfbba0bad6
MD5 dd4f6837b8633ab9e0e32ef8cc895a67
BLAKE2b-256 ee0018bdff506e44b38e30591161055a32911f9261765618f25facbd34570b77

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cd49505273d83809bd018f7a5f67f4a3ddffc18b6ad8151f25c451d360b872d4
MD5 fddf6d9affa19657fb57104ad9a8969d
BLAKE2b-256 dcd0bd86d1c648f5dd670f71c2298ace062f25db6b6b8c208eabdf7615743311

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 14cfb7212032a42409c3618792c061683087d90fb0ea6f318660b9aed54b24ac
MD5 b83a6fc9e050d514e6c68290253f748d
BLAKE2b-256 686bae3f84bd9a852e6ee5bb4b3515e0a4134486858d829d431c5ac079ae2ac2

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 11cd9e8333aacf95f887e804c642227284bcd10b253a4ae82e695d490b53f7b7
MD5 b0cf905d79feedbfb3b3d3562285d8dd
BLAKE2b-256 eb839c242165a52d9904bdb22d7b21ad0b0b4d0ac1a0f2e58ae5ef9d11b77857

See more details on using hashes here.

File details

Details for the file json_comments-0.1.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for json_comments-0.1.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4287b22cccddcb5160cd6d48822b1254263239d08abaff0949cc8fef52182315
MD5 b43957edf0d9d2f2453eb062c1c46677
BLAKE2b-256 7d736a0aaa8df7cf9195975c8b9a25de8dd2b5e4b82d5e3acb656b974c854ee7

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