From 3f34f8c0b71da858814965ffe56647001c894dca Mon Sep 17 00:00:00 2001 From: bbrunell Date: Sat, 13 Nov 2021 11:34:44 +0100 Subject: [PATCH 1/2] Fix: Array relaxed extended json --- src/bson.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bson.rs b/src/bson.rs index 08167f35..90aff5e2 100644 --- a/src/bson.rs +++ b/src/bson.rs @@ -379,7 +379,7 @@ impl Bson { } Bson::Double(v) => json!(v), Bson::String(v) => json!(v), - Bson::Array(v) => json!(v), + Bson::Array(v) => Value::Array(v.into_iter().map(Bson::into_relaxed_extjson).collect()), Bson::Document(v) => { Value::Object(v.into_iter().map(|(k, v)| (k, Value::from(v))).collect()) } From 98ed175fbe8ae1a27953c477c7e54645a651f603 Mon Sep 17 00:00:00 2001 From: bbrunell Date: Tue, 16 Nov 2021 16:41:43 +0100 Subject: [PATCH 2/2] Update: Document relaxed extended json (#325) --- src/bson.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/bson.rs b/src/bson.rs index 90aff5e2..11ee714c 100644 --- a/src/bson.rs +++ b/src/bson.rs @@ -380,9 +380,11 @@ impl Bson { Bson::Double(v) => json!(v), Bson::String(v) => json!(v), Bson::Array(v) => Value::Array(v.into_iter().map(Bson::into_relaxed_extjson).collect()), - Bson::Document(v) => { - Value::Object(v.into_iter().map(|(k, v)| (k, Value::from(v))).collect()) - } + Bson::Document(v) => Value::Object( + v.into_iter() + .map(|(k, v)| (k, v.into_relaxed_extjson())) + .collect(), + ), Bson::Boolean(v) => json!(v), Bson::Null => Value::Null, Bson::RegularExpression(Regex { pattern, options }) => {