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

Support deserializing from &RawValue #1072

Merged
merged 1 commit into from
Sep 13, 2023
Merged

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Sep 13, 2023

use std::collections::BTreeMap;

fn main() {
    let j = r#" {"x": {"k": "v"}} "#;
    let deferred: BTreeMap<&str, &serde_json::value::RawValue> = serde_json::from_str(j).unwrap();
    let x: BTreeMap<&str, &str> = serde::Deserialize::deserialize(deferred["x"]).unwrap();
    println!("{:?}", x);
}

@dtolnay dtolnay merged commit 4ea34a2 into serde-rs:master Sep 13, 2023
13 checks passed
@dtolnay dtolnay deleted the rawvalue branch September 13, 2023 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant