cirq.protocols.json_serializable_dataclass

Create a dataclass that supports JSON serialization.

This function defers to the ordinary dataclass decorator but appends the _json_dict_ protocol method which automatically determines the appropriate fields from the dataclass.

Dataclasses are implemented with somewhat complex metaprogramming, and tooling (PyCharm, mypy) have special cases for dealing with classes decorated with @dataclass. There is very little support (and no plans for support) for decorators that wrap @dataclass like this. Consider explicitly defining _json_dict_ on your dataclasses which simply return dataclass_json_dict(self).

namespace An optional prefix to the value associated with the key "cirq_type". The namespace name will be joined with the class name via a dot (.) init, repr, eq, order, unsafe_hash, frozen: Forwarded to the dataclass constructor.