Skip to main content

JSON with Comments (jsonc) for Python

Project description

JSON with Comments for Python

pypi version Python package Python Versions

Features

  • load(), loads()
    • Remove single line (//) and block comments (/* */)
    • Remove trailing commas from arrays and objects
  • dump(), dumps()
    • Add comments
    • Add trailing commas

Usage

pip install json-with-comments
>>> import jsonc
>>> jsonc.loads("{// comment \n}")
{}
>>> jsonc.loads("{/* comment */}")
{}
>>> jsonc.loads('{"spam": "ham // egg" /* comment */}')
{'spam': 'ham // egg'}
>>> jsonc.loads('{"spam": /* comment */"ham /* egg */"}')
{'spam': 'ham /* egg */'}

And just like json module

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

json_with_comments-1.2.10.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

json_with_comments-1.2.10-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file json_with_comments-1.2.10.tar.gz.

File metadata

  • Download URL: json_with_comments-1.2.10.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for json_with_comments-1.2.10.tar.gz
Algorithm Hash digest
SHA256 0020b321cf6c80963c85f95ce985e71332f1797ed49abfd1cd675b3bdee24a28
MD5 cb4aab307eb8256bbc6aeb50e5cf904c
BLAKE2b-256 bf6d638e8adbb2b92bb0803c092dd8ae6482945961c8545fc7e2f21c48233928

See more details on using hashes here.

Provenance

The following attestation bundles were made for json_with_comments-1.2.10.tar.gz:

Publisher: publish.yml on n-takumasa/json-with-comments

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

File details

Details for the file json_with_comments-1.2.10-py3-none-any.whl.

File metadata

File hashes

Hashes for json_with_comments-1.2.10-py3-none-any.whl
Algorithm Hash digest
SHA256 d7989c2577b1f8cbba735209f8d388d21017feb42ef30c29c230040f86b42700
MD5 7c78bd102578609bb70b4647d715cb16
BLAKE2b-256 008af67dadb0648f00ac2249d3ef32532f0d5a2e72016f8426290ce6fe575870

See more details on using hashes here.

Provenance

The following attestation bundles were made for json_with_comments-1.2.10-py3-none-any.whl:

Publisher: publish.yml on n-takumasa/json-with-comments

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