PSeitz / serde_json_borrow

Fast JSON deserialization on borrowed data
MIT License
69 stars 9 forks source link

Implement Deserializer<'_> / IntoDeserializer for Value<'_> #10

Open A-Manning opened 9 months ago

A-Manning commented 9 months ago

Would it be possible to implement serde::Deserializer<'ctx> / serde::de::IntoDeserializer for serde_json_borrow::Value<'ctx>?

serde_json_borrow::Value is often useful as an intermediate value when deserializing, and so it would be nice to be able to deserialize from a serde_json_borrow::Value in the same way that one can from a serde_json::Value. Note that serde_json::Value implements serde::Deserializer and serde::de::IntoDeserializer, and serde_json also provides the helpful serde_json::from_value function to deserialize from a serde_json::Value.

PSeitz commented 1 month ago

Sorry for the late reply. I think that would be a good addition to reach feature parity. I would accept an PR for that.

And just as a heads up, I consider removing the limitation that keys in objects are not allowed to have any JSON escaping characters. (maybe as a feature flag)

ssddOnTop commented 2 weeks ago

And just as a heads up, I consider removing the limitation that keys in objects are not allowed to have any JSON escaping characters. (maybe as a feature flag)

can you give an example of some failing case