-
Notifications
You must be signed in to change notification settings - Fork 65
Closed
Labels
Milestone
Description
Right now it's kind of verbose to do this:
let j_test = object!{
"hi" => 123,
"na" => 345
};
let mut j_test2 = json::JsonValue::new_object();
for (key, val) in j_test.entries() {
j_test2["subsub"][key] = val.as_u32().into();
}
Error:
trait bound `json::JsonValue: std::ops::Index<&std::string::String>` is not satisfied
You have to write
j_test2["subsub"][&**key] = val.as_u32().into();
And if you use ref you have to write:
for (ref key, ref val) in j_test.entries() {
j_test2["subsub"][&***key] = val.as_u32().into();
}
As an idea for improvements.