Retrieve column in the record struct #378
-
Hello, i want to retrieve a column dynamically with his value just like a metadata json object with The struct in question: #[derive(Debug, Clone, Serialize, Deserialize)]
struct Item {
#[serde(rename(deserialize = "ID"))]
id: usize,
metadata: HashMap<String, Value>,
} the data looks like:
I that possible in csv ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
You might consider just using s |
Beta Was this translation helpful? Give feedback.
csv
isn't a typed format, so comparing it withjson
in this specific regard doesn't really make sense. JSON specifically has numbers, strings, arrays, objects and so on.csv
has nothing but records and fields, with no inherent nesting structure, and where all fields are just strings. Any additional encoding on top of that is generally bespoke.You might consider just using s
csv::Record
. That exposes the "records are just a sequence of strings" representation. That is the spiritual equivalent of aserde_json::Value
.