File: README.rst

package info (click to toggle)
python-commentjson 0.8.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 168 kB
  • sloc: python: 509; makefile: 4
file content (59 lines) | stat: -rwxr-xr-x 1,403 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
===========
commentjson
===========

`commentjson` (Comment JSON) is a Python package that helps you create JSON
files with Python and JavaScript style inline comments. Its API is very similar
to the Python standard library's `json`_ module.

.. _`json`: http://docs.python.org/2/library/json.html

.. image:: https://travis-ci.org/vaidik/commentjson.png

Installation
============

    pip install commentjson

Basic Usage
===========

.. code-block:: python

    >>> import commentjson
    >>>
    >>> json_string = """{
    ...     "name": "Vaidik Kapoor", # Person's name
    ...     "location": "Delhi, India", // Person's location
    ...
    ...     # 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`_.

.. _`here`: http://commentjson.readthedocs.org/en/latest/

Tests
=====

    python setup.py test

License
=======

See `license`_.

.. _`license`: https://github.com/vaidik/commentjson/blob/master/LICENSE.rst