#Use serde_json to serialize/deserialize one struct field

2 messages · Page 1 of 1 (latest)

sacred raven
#

I have a struct that looks something like this

#[derive(Serialize, Deserialize)]
pub struct Foo{
  bar: String,
  baz: Vec<String> // This one is stored as JSON
}

Is there a way with serde_with or serde_as so that baz will be converted to JSON before the whole thing is serialized by serde_qs? And the inverse when deserializing?

Thanks!