We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
#![feature(custom_derive, plugin)] #![plugin(serde_macros)] use std::collections::BTreeMap; extern crate serde_json; #[derive(Serialize, Deserialize)] struct Bar(BTreeMap<String, i32>); fn main() { let mut b = Bar(BTreeMap::new()); b.0.insert(String::from("foo"), 123); // prints {"foo":123} println!("{}", serde_json::to_string(&b).unwrap()); let mut outer = BTreeMap::new(); outer.insert(String::from("outer"), serde_json::to_value(&b)); // prints {"outer":[{"foo":123}]} println!("{}", serde_json::to_string(&outer).unwrap()); }
I would expect the second print to be {"outer":{"foo":123}}.
{"outer":{"foo":123}}
The text was updated successfully, but these errors were encountered:
dtolnay
No branches or pull requests
I would expect the second print to be
{"outer":{"foo":123}}
.The text was updated successfully, but these errors were encountered: