Mercurial > hgrepos > Python > libs > ConfigMix
comparison doc/introduction.rst @ 131:b34ad08e7198
Document the JSON files
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Wed, 04 Apr 2018 23:49:43 +0200 |
| parents | 21d92ff8cf31 |
| children | 4ec783899835 |
comparison
equal
deleted
inserted
replaced
| 130:b11af3ded7c1 | 131:b34ad08e7198 |
|---|---|
| 6 ============ | 6 ============ |
| 7 | 7 |
| 8 The configurations can be read from different types of files: | 8 The configurations can be read from different types of files: |
| 9 | 9 |
| 10 - :ref:`YAML files <yaml-files>` | 10 - :ref:`YAML files <yaml-files>` |
| 11 - :ref:`JSON files <json-files>` | 11 - :ref:`JSON files <json-files>` |
| 12 - :ref:`INI files <ini-files>` | 12 - :ref:`INI files <ini-files>` |
| 13 - :ref:`executable Python scripts <executable-python-scripts>` | 13 - :ref:`executable Python scripts <executable-python-scripts>` |
| 14 | 14 |
| 15 | 15 |
| 16 .. _yaml-files: | 16 .. _yaml-files: |
| 32 .. _json-files: | 32 .. _json-files: |
| 33 | 33 |
| 34 JSON files | 34 JSON files |
| 35 ---------- | 35 ---------- |
| 36 | 36 |
| 37 .. todo:: Document basic JSON usage | 37 Read the JSON file with the help of Python's native :mod:`json` package. |
| 38 | |
| 39 .. note:: All strings are returned as Unicode text strings. | |
| 40 | |
| 41 .. note:: The root object must be an *object* and therefore decode into | |
| 42 a Python :class:`dict` alike. | |
| 43 | |
| 44 .. todo:: Handle JSON comments by special attributes which will | |
| 45 filtered out on further processing. Javascript comments are | |
| 46 not allowed by the JSON specification. | |
| 47 | |
| 48 An example is: | |
| 49 | |
| 50 .. literalinclude:: ../tests/data/conf10.json | |
| 51 :language: js | |
| 38 | 52 |
| 39 | 53 |
| 40 .. _ini-files: | 54 .. _ini-files: |
| 41 | 55 |
| 42 INI Files | 56 INI Files |
