Skip to main content

JSON for Humans, allows comments and is less error prone.

Project description


Hjson, the Human JSON. A configuration file format that caters to humans and helps reduce the errors they make.

It supports #, // and /**/ style comments as well as avoiding trailing/missing comma and other mistakes. For details and syntax see

Hjson works with Python 2.5+ and Python 3.3+ (forked from simplejson)



import hjson

Decoding Hjson

text = """{
  foo: a
  bar: 1



OrderedDict([('foo', 'a'), ('bar', 1)])

Encoding Python object hierarchies

hjson.dumps({'foo': 'text', 'bar': (1, 2)})


  foo: text

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]}]'

From the Commandline

Use hjson.tool to validate and convert.

python -m hjson.tool [FORMAT] [INFILE [OUTFILE]]

Formats: - -h: print Hjson - -j: print formatted JSON - -c: print compact JSON

E.g. echo '{"json":"obj"}' | python -m hjson.tool


See the simplejson docs:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date (56.5 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page