Skip to content

Commit cde0c54

Browse files
pacifistespatrickfreed
authored andcommitted
RUST-1107 Fix array relaxed extended json (#325)
1 parent e13c774 commit cde0c54

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/bson.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,12 @@ impl Bson {
379379
}
380380
Bson::Double(v) => json!(v),
381381
Bson::String(v) => json!(v),
382-
Bson::Array(v) => json!(v),
383-
Bson::Document(v) => {
384-
Value::Object(v.into_iter().map(|(k, v)| (k, Value::from(v))).collect())
385-
}
382+
Bson::Array(v) => Value::Array(v.into_iter().map(Bson::into_relaxed_extjson).collect()),
383+
Bson::Document(v) => Value::Object(
384+
v.into_iter()
385+
.map(|(k, v)| (k, v.into_relaxed_extjson()))
386+
.collect(),
387+
),
386388
Bson::Boolean(v) => json!(v),
387389
Bson::Null => Value::Null,
388390
Bson::RegularExpression(Regex { pattern, options }) => {

0 commit comments

Comments
 (0)