A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML
BSD 3-Clause "New" or "Revised" License
2.43k
stars
75
forks
source link
Converting an object / dict to a struct where the struct contains a Raw field fails with "Expected `any`, got ..." #699
Closed
indrat closed 1 month ago
Description
Description
Converting using
msgspec.convert
from an object withfrom_attributes=True
to a struct that contains aRaw
field doesn't appear to work.Example
Given a struct like:
That is used to deserialise json successfully, e.g
b'{"result": {"status": 0}}'
=>Wrapper(result=<msgspec.Raw object at 0x1028b3bb0>)
However going from an object or dict and trying to
msgspec.convert
it into aWrapper
doesn't appear to work or am I doing something wrong?Expected