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-2.0.7.tar.gz (39.1 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: hjson-2.0.7.tar.gz
  • Upload date:
  • Size: 39.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for hjson-2.0.7.tar.gz
Algorithm Hash digest
SHA256 057f54e7a19ee59d06eed287241b009f9e0d351b629ea60b41a964cde4a524e7
MD5 8d269c0948d9a02e826f04b5be4a7da5
BLAKE2b-256 08a9669ea4730ced7bca8ed0485cefd55b9520e232b5ba8f9707c7eedd209eca

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