hjson-py

Hjson for Python

Popularity
2.6
Declining
Activity
2.3
-
220
8
19

Description

JSON is easy for humans to read and write... in theory. In practice JSON gives us plenty of opportunities to make mistakes without even realizing it.

Hjson is a syntax extension to JSON. It's NOT a proposal to replace JSON or to incorporate it into the JSON spec itself. It's intended to be used like a user interface for humans, to read and edit before passing the JSON data to the machine.

Code Quality Rank: L3
Programming language: Python
License: GNU General Public License v3.0 or later
Latest version: v3.6.5

hjson-py alternatives and similar packages

Based on the "Serialization" category.
Alternatively, view hjson-py alternatives based on common mentions on social networks and blogs.

* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.

Do you think we are missing an alternative of hjson-py or a related project?

Add another 'Serialization' Package

README

hjson-py

Build Status PyPI version

Hjson, a user interface for JSON

Hjson Intro

Hjson works with Python 2.5+ and Python 3.3+

The Python implementation of Hjson is based on simplejson. For other platforms see hjson.github.io.

Installation

pip will also add the hjson tool to your PATH (try echo '{a:1}'|hjson).

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 documentation

History

[see history.md](history.md)

Do not miss the trending, packages, news and articles with our weekly report.

Awesome Python is part of the LibHunt network. Terms. Privacy Policy.

(CC)
BY-SA
We recommend Spin The Wheel Of Names for a cryptographically secure random name picker.

AltStyle によって変換されたページ (->オリジナル) /