JSON Utilities (fixie.jsonutils)

Standard fixie tools for dealing with JSON.

fixie.jsonutils.appendline(obj, f, **kwargs)[source]

Appends a line to a line-oriented JSON file (either str path or file handle).

fixie.jsonutils.decode(s, **kwargs)[source]
fixie.jsonutils.default(obj)[source]

For custom object serialization.

fixie.jsonutils.dump(obj, fp, sort_keys=True, separators=(', ', ':'), default=<function default>, **kwargs)[source]

Returns a JSON string from a Python object.

fixie.jsonutils.dumps(obj, sort_keys=True, separators=(', ', ':'), default=<function default>, **kwargs)[source]

Returns a JSON string from a Python object.

fixie.jsonutils.encode(obj, **kwargs)[source]

Encodes JSON with forward slash encoding, such as in Tornado.

fixie.jsonutils.load(fp, object_hook=<function object_hook>, **kwargs)[source]

Loads a file object as JSON, with appropriate object hooks.

fixie.jsonutils.loadlines(f, **kwargs)[source]

Loads lines from a file (either str path of file handle).

fixie.jsonutils.loads(s, object_hook=<function object_hook>, **kwargs)[source]

Loads a string as JSON, with approriate object hooks

fixie.jsonutils.object_hook(dct)[source]

For custom object deserialization.