cirq.protocols.dataclass_json_dict

Return a dictionary suitable for _jsondict from a dataclass.

Dataclasses keep track of their relevant fields, so we can automatically generate these.

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 @cirq.json_serializable_dataclass) or combining additional decorators with @dataclass. Although not as elegant, you may want to consider explicitly defining _json_dict_ on your dataclasses which simply return dataclass_json_dict(self).