Closed dcormier closed 2 months ago
You need to switch the order of the macro annotations around. serde_as
must always come before the derive
. The reason is that the macro order is significant in Rust as the macros are expanded top down. You need to place serde_as
first as it needs to run before the derive generates all its code, as otherwise the derive will not know about the changed behavior. That should fix everything. You now just need to import serde_with::json::JsonString
.
#[serde_as]
#[derive(Debug, Deserialize)]
Am I missing something, or does using
JsonString
to deserialize a JSON string containing an array of objects not work?The output is: