Skip to main content

jcson - enhanced json for configuration

Project description

jcson - enhanced json for configuration

Build Status

Introdcution

The jcson python module is an enhanced json parser, that supports:

  • path expression subtitutions, with fallback to environment variables.
  • include directive
  • new line and inline comments

Path expression sustitutions

Substitutions are a way of referring to other parts of the configuration tree. The syntax is ${pathe.xpression} where the path.expression is used to write out a path through the object graph, like ${foo.bar} that refers to { "foo": { "bar" : 42 } If a substitution is not present within a configuration tree, search will attempt to fallback to environment variables.

Include directive

An include directive consists of the unquoted string include followed by quoted filename.

include "include.jcson"

Instaling

Install and update using pip:

pip install -U jcson

A simple example

Sample config file simple.jcson:

{
    "foo" : {
        "bar": "some value"
    },

    "bar_value": "${foo.bar}",

    "concatenated": "${foo.bar} used later"
}

Pyhton code that reads it:

import json
import jcson

c = jcson.read('simple.jcson')

print (json.dumps(c, indent=4))

Output:

{
    "foo" : {
        "bar": "some value"
    },

    "bar_value": "some value",

    "concatenated": "some value used later"
}

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

jcson-0.1.6.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

jcson-0.1.6-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file jcson-0.1.6.tar.gz.

File metadata

  • Download URL: jcson-0.1.6.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for jcson-0.1.6.tar.gz
Algorithm Hash digest
SHA256 30eed8f5ceb90d81b6af25310f2d70dbd7766c5a4eb6185825f5b32e2de42a8d
MD5 f9c2834803cd922407de0dcbe4364578
BLAKE2b-256 6c51d5dc6cc9798a83fafe58baa72603fd96d048a102d14894565b3faa6f0ae6

See more details on using hashes here.

File details

Details for the file jcson-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: jcson-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3

File hashes

Hashes for jcson-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c7dd6d7bada87ca00ffc5da1baa3d7d3850abfee928817bf955f9564dadb3100
MD5 81d00a5edf4e4aeba3f86088970b69c2
BLAKE2b-256 48abf6e32ba072d9a9632a8f6a55f9b4bcddb3bc82970e71b38aa44996d56798

See more details on using hashes here.

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