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

Uploaded Source

Built Distribution

hjson-3.1.0-py3-none-any.whl (54.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hjson-3.1.0.tar.gz
  • Upload date:
  • Size: 40.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for hjson-3.1.0.tar.gz
Algorithm Hash digest
SHA256 55af475a27cf83a7969c808399d7bccdec8fb836a07ddbd574587593b9cdcf75
MD5 6cf6947b3bdc0c58608a378ac05a451c
BLAKE2b-256 82e50b56d723a76ca67abadbf7fb71609fb0ea7e6926e94fcca6c65a85b36a0e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hjson-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 54.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for hjson-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65713cdcf13214fb554eb8b4ef803419733f4f5e551047c9b711098ab7186b89
MD5 ff4571399698bf81c748a54042ac4237
BLAKE2b-256 1f7f13cd798d180af4bf4c0ceddeefba2b864a63c71645abc0308b768d67bb81

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page