Implement From serde_json::Value for Value
nicolaiunrein opened this issue · 3 comments
This should be straight forward for all types except for Number. Serde_jsons underlying type is an enum of either u64, i64 or f64. Being able to convert from these would involve lifting Number to i128 to provide a lossless conversion from u64 or implementing Number as an enum like serde_json. I think I would go with the first option.
Please let me know if you want me to submit a PR for this!
Thanks
I'm not sure we need i128 for the conversion. Other than that PR is appreciated. (This should be feature-gated though).
Well, turns out I was depending on 0.2.3 which does not use the Text trait. I do not see a way to get around this easily and that this crate focuses on constructing Value types via text deserialisation/parsing which is OK but conflicts with my idea of this feature request.
Well, maybe From imlementation will not work, but we can easily do a method into_json_value for that.