Hjson, a user interface for JSON.
Project description
hjson-py
Hjson, a user interface for JSON
Hjson works with Python 2.5+ and Python 3.3+ (based on simplejson)
Installation
pip install hjson
or download from https://pypi.python.org/pypi/hjson
Commandline
Usage: hjson [options] hjson [options] <input> hjson (-h | --help) hjson (-V | --version) Options: -h --help Show this screen. -j Output as formatted JSON. -c Output as JSON. -V --version Show version.
E.g. echo '{"json":"obj"}' | hjson
Usage
import hjson
Decoding Hjson
text = """{
foo: a
bar: 1
}"""
hjson.loads(text)
Result:
OrderedDict([('foo', 'a'), ('bar', 1)])
Encoding Python object hierarchies
hjson.dumps({'foo': 'text', 'bar': (1, 2)})
Result:
{ foo: text bar: [ 1 2 ] }
Encoding as JSON
Note that this is probably not as performant as the simplejson version.
hjson.dumpsJSON(['foo', {'bar': ('baz', None, 1.0, 2)}])
Result: '["foo", {"bar": ["baz", null, 1.0, 2]}]'
API
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hjson-3.1.0.tar.gz
(40.5 kB
view hashes)
Built Distribution
hjson-3.1.0-py3-none-any.whl
(54.0 kB
view hashes)