Open AlJohri opened 1 year ago
Ah, looks like I need to use serde_json::from_value
as opposed to prost_wkt_types::Value::from
like so:
let aaaaaaaaaa = MyRustStruct::default();
let aaaaaaaaaa = serde_json::to_value(aaaaaaaaaa)?
let aaaaaaaaaa: prost_wkt_types::Value = serde_json::from_value(aaaaaaaaaa)?
I think this issue can be closed although I'd be curious why we don't implement prost_wkt_types::Value::from
for serde_json::Value
?
For my use case there was no reason yet to implement this but I suppose it can be added. I'm not sure yet if this should be a From or a TryFrom.
Is there any examples of how to convert between these two types? Or how to go from a rust struct to
google.protobuf.Value
? I thought with the serde support we would get this out of the box, but I am running into this error:I documented how I was able to do this manually without prost-wkt in this StackOverflow answer, but it would be great to use the Serialize/Deserialize machinery here.