Module: cirq.protocols.json_serialization

Classes

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.

Functions

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.

read_json_gzip(...)

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

to_json_gzip(...)

Type Aliases

ObjectFactory: The central part of internal API.

DEFAULT_RESOLVERS [<function _lazy_resolver.<locals>.json_resolver at 0x7f1b72d9b3b0>, <function _lazy_resolver.<locals>.json_resolver at 0x7f1b62ca4950>]