Module: cirq.protocols.json_serialization


class CirqEncoder: Extend json.JSONEncoder to support Cirq objects.

class JsonResolver: Protocol for json resolver functions passed to read_json.

class SerializableByKey: Protocol for objects that can be serialized to a key + context.

class SupportsJSON: An object that can be turned into JSON dictionaries.


dataclass_json_dict(...): Return a dictionary suitable for _jsondict from a dataclass.

get_serializable_by_keys(...): Returns all SerializableByKeys contained by obj.

has_serializable_by_keys(...): Returns true if obj contains one or more SerializableByKey objects.

json_serializable_dataclass(...): Create a dataclass that supports JSON serialization.

obj_to_dict_helper(...): Construct a dictionary containing attributes from obj

read_json(...): Read a JSON file that optionally contains cirq objects.


to_json(...): Write a JSON file containing a representation of obj.


Type Aliases

ObjectFactory: The central part of internal API.

DEFAULT_RESOLVERS [<function _lazy_resolver.<locals>.json_resolver at 0x7fef5c7460e0>, <function _lazy_resolver.<locals>.json_resolver at 0x7fef504613b0>, <function _lazy_resolver.<locals>.json_resolver at 0x7fef5d60ed40>, <function _lazy_resolver.<locals>.json_resolver at 0x7fef5040e7a0>]