diff --git a/lib/src/sql/array.rs b/lib/src/sql/array.rs index d9182ffd..02b272eb 100644 --- a/lib/src/sql/array.rs +++ b/lib/src/sql/array.rs @@ -14,6 +14,7 @@ use crate::sql::value::{value, Value}; use nom::character::complete::char; use nom::combinator::opt; use nom::multi::separated_list0; +use serde::ser::SerializeSeq; use serde::{Deserialize, Serialize}; use std::collections::HashSet; use std::fmt::{self, Display, Formatter, Write}; @@ -167,7 +168,11 @@ impl Serialize for Array { if is_internal_serialization() { serializer.serialize_newtype_struct(TOKEN, &self.0) } else { - serializer.serialize_some(&self.to_string()) + let mut arr = serializer.serialize_seq(Some(self.len()))?; + for v in &self.0 { + arr.serialize_element(v)?; + } + arr.end() } } } diff --git a/lib/src/sql/object.rs b/lib/src/sql/object.rs index 0dbcd9fe..fdfac3cc 100644 --- a/lib/src/sql/object.rs +++ b/lib/src/sql/object.rs @@ -175,7 +175,7 @@ impl Serialize for Object { serializer.serialize_newtype_struct(TOKEN, &self.0) } else { let mut map = serializer.serialize_map(Some(self.len()))?; - for (ref k, ref v) in &self.0 { + for (k, v) in &self.0 { map.serialize_key(k)?; map.serialize_value(v)?; }