Skip to main content

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

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

hjson-py

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

hjson-3.0.2.tar.gz (39.1 kB view details)

Uploaded Source

Built Distribution

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

hjson-3.0.2-py3-none-any.whl (54.2 kB view details)

Uploaded Python 3

File details

Details for the file hjson-3.0.2.tar.gz.

File metadata

  • Download URL: hjson-3.0.2.tar.gz
  • Upload date:
  • Size: 39.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.7

File hashes

Hashes for hjson-3.0.2.tar.gz
Algorithm Hash digest
SHA256 2838fd7200e5839ea4516ece953f3a19892c41089f0d933ba3f68e596aacfcd5
MD5 ee2dc1a306f41fad689b864d2e5a1e66
BLAKE2b-256 bdddc0eb550f14daf2a15d387dd1479dd4880fefcfa66d42e64454feecc18331

See more details on using hashes here.

File details

Details for the file hjson-3.0.2-py3-none-any.whl.

File metadata

  • Download URL: hjson-3.0.2-py3-none-any.whl
  • Upload date:
  • Size: 54.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.7

File hashes

Hashes for hjson-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5546438bf4e1b52bc964c6a47c4ed10fa5fba8a1b264e22efa893e333baad2db
MD5 5f18f25706dd420c9263d3d6e07fe9fe
BLAKE2b-256 74daf7c0e3407f1f600326ff762373f57971a16b771435736b70ce9c24fbe761

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