quininer / cbor4ii

CBOR: Concise Binary Object Representation
MIT License
58 stars 6 forks source link

Deserialize `Value` into `T: Deserialize` #33

Open tqwewe opened 2 months ago

tqwewe commented 2 months ago

If I have a Value, how can I convert this to a type which implements serde::Deserialize?

Libraries like serde_json have to_value and from_value functions for this, but I don't see a way to do this currently with cbor4ii.

How should I do this? Am I required to serialize the value to a Vec<u8> and deserialize again?

quininer commented 2 months ago

We need to implement Deserializer trait for Value, which shouldn't be hard. but I don't have time to implement it in short term.

Welcome PR :)