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.1.tar.gz (43.6 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.1-py3-none-any.whl (54.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for hjson-3.0.1.tar.gz
Algorithm Hash digest
SHA256 1d1727faa6aaef2973921877125a3ab7c5f6d34b93233179d01770f41fab51f9
MD5 afac353feb47003c8ad31e5b7197ac6a
BLAKE2b-256 8a926b6b85064f8a88cb3b31901d839e7b45c33e4ee450bb1b3cf0c226cca8ec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hjson-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 54.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 febbfbd43e64d2a822efe8b6c720683954b48c0bb1532170c05a7fc8470d3426
MD5 44d421e4b58f5ba0ff4a693ff261e9a5
BLAKE2b-256 80752a724bd8e31e71fecead388d0d80c99819924df8dce9b476a24783d84b93

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