diff --git a/contrib/lib/src/json.rs b/contrib/lib/src/json.rs index da9099ba..7bd3f944 100644 --- a/contrib/lib/src/json.rs +++ b/contrib/lib/src/json.rs @@ -19,6 +19,7 @@ extern crate serde_json; use std::ops::{Deref, DerefMut}; use std::io::{self, Read}; +use std::iter::FromIterator; use rocket::request::Request; use rocket::outcome::Outcome::*; @@ -277,6 +278,12 @@ impl From for JsonValue { } } +impl FromIterator for JsonValue where serde_json::Value: FromIterator { + fn from_iter>(iter: I) -> Self { + JsonValue(serde_json::Value::from_iter(iter)) + } +} + /// Serializes the value into JSON. Returns a response with Content-Type JSON /// and a fixed-size body with the serialized value. impl<'a> Responder<'a> for JsonValue {