Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Deserializer for Map<String, Value> and &Map<String, Value> #1134

Closed
swlynch99 opened this issue May 14, 2024 · 0 comments · Fixed by #1135
Closed

Implement Deserializer for Map<String, Value> and &Map<String, Value> #1134

swlynch99 opened this issue May 14, 2024 · 0 comments · Fixed by #1135

Comments

@swlynch99
Copy link
Contributor

swlynch99 commented May 14, 2024

Sometimes I want to work with a Value that I know to be a json object. Map<String, Value> is the correct type to use for this but it is not possible to deserialize from a Map<String, Value> to a more concrete without going through Value. It would be nice if Map<String, Value> implemented Deserializer so this all just works.

My actual use case is that I have a &Map<String, Value> that I would like to deserialize to a concrete struct, which is harder to come up with a workaround for. With an owned value I could just do T::deserialize(Value::Object(map)) but that doesn't work for a reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant