Open yukinarit opened 3 years ago
@yukinarit one more: namedtuple
:
Point = namedtuple('Point', ['x', 'y'])
@dataclass
class Foo:
p: Point
f = Foo(Point(1,2))
to_json(f)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/python/3.12.2/lib/python3.12/site-packages/serde/json.py", line 75, in to_json
to_dict(obj, c=cls, reuse_instances=reuse_instances, convert_sets=convert_sets), **opts
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/python/3.12.2/lib/python3.12/site-packages/serde/se.py", line 458, in to_dict
return to_obj( # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/python/3.12.2/lib/python3.12/site-packages/serde/se.py", line 386, in to_obj
raise SerdeError(e) from None
serde.compat.SerdeError: Unsupported type: Point