Relative Content

Tag Archive for jsonrustserde

serde/rust deserialize JSON into Hashmap

How to properly define the data types such that the JSON de-serialize works fine with Serde/Rust for the following examples? I believe the Hashmap is the culprit somehow. Unable to tell what precisely is wrong. I hope for more complex examples involving logical and comparison operators to work as well. Appreciate any help.

Use of Serde’s #[serde(transparent)]

I needed to deserialise a “bare” json array of arrays so I wrote the code below. It works as intended and is based on these stackoverflow questions Deserializing a DateTime from a string millisecond timestamp with serde and Rust: Deserialize a JSON array into a very simple custom table. However, I don’t know why #[serde(transparent)] is required and what this attribute is doing.