pygsti.serialization.json

Defines json package interface capable of encoding pyGSTi objects

Module Contents

Classes

PygstiJSONEncoder

JSON Encoder capable of handling pyGSTi types

Functions

dumps(obj, **kwargs)

An overload of json.dumps that works with pyGSTi types

dump(obj, f, **kwargs)

An overload of json.dump that works with pyGSTi types

loads(s, **kwargs)

An overload of json.loads that works with pyGSTi types

load(f, **kwargs)

An overload of json.load that works with pyGSTi types

class pygsti.serialization.json.PygstiJSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)

Bases: json.JSONEncoder

JSON Encoder capable of handling pyGSTi types

encode(self, item)

Main encoding function

Parameters

item (various) – item to encode

Returns

various

pygsti.serialization.json.dumps(obj, **kwargs)

An overload of json.dumps that works with pyGSTi types

Parameters

obj (object) – object to serialize.

Returns

str

pygsti.serialization.json.dump(obj, f, **kwargs)

An overload of json.dump that works with pyGSTi types

Parameters
  • obj (object) – object to serialize

  • f (file) – output file

Returns

None

pygsti.serialization.json.loads(s, **kwargs)

An overload of json.loads that works with pyGSTi types

Parameters

s (str) – serialized object(s)

Returns

object

pygsti.serialization.json.load(f, **kwargs)

An overload of json.load that works with pyGSTi types

Parameters

f (file) – open file to read from

Returns

object