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.9.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for json_with_comments-1.2.9.tar.gz
Algorithm Hash digest
SHA256 6be24161c206b9b2b3f6ba37cefaf40e10a941bba59b63aa234dc809a1f0b41b
MD5 c67da131c7ab0085f7ffa871d979d331
BLAKE2b-256 cabb3e940bde66d75fa5438dfe20d21b04f99daf025b27d9a1101172f7df8bb4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for json_with_comments-1.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 48ac9909ca8036737d9742025adb5598c3b80548f04ae1718e61bf6b879b91b7
MD5 3753906214a326577d1cbadcbe1e6711
BLAKE2b-256 52bae92ad9d8b68cdf60fca7b1e78f432514201d1c3f02fc0f4ce4226d529f9e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page