commentjson (Comment JSON) is a Python package that helps you create JSON files with comments. Its API is very similar to the Python standard library’s json module.
Installation
pip install commentjson
Basic Usage
>>> import commentjson
>>>
>>> json_string = """{
... "name": "Vaidik Kapoor", # Person's name
... "location": "Delhi, India",
...
... # Section contains info about person's appearance
... "appearance": {
... "hair_color": "black",
... "eyes_color": "black",
... "height": "6"
... }
... }"""
>>>
>>> json_loaded = commentjson.loads(json_string)
>>> print json_loaded
{u'appearance': {u'eyes_color': u'black', u'hair_color': u'black', u'height': u'6'}, u'name': u'Vaidik Kapoor', u'location': u'Delhi, India'}
Documentation
Complete documentation can be found here.
Tests
python setup.py test
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
commentjson-0.3.tar.gz
(3.9 kB
view details)
File details
Details for the file commentjson-0.3.tar.gz.
File metadata
- Download URL: commentjson-0.3.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edd5b01b7cdf359f53748f8ab2e91fea9cffbc4e42839eddc2e3b7ddc3c2c880
|
|
| MD5 |
cfe63d4dfdc8587d77618fd2159f5dfc
|
|
| BLAKE2b-256 |
d8322aed29bc8fc9e85ba7600a216ecdd68289e113b7417ec827b037bfac815e
|