diff --git a/src/bin.rs b/src/bin.rs index 7e0f6ff..34f0f02 100644 --- a/src/bin.rs +++ b/src/bin.rs @@ -177,7 +177,15 @@ impl CompareContextElement for serde_json::Value { // When doing a greater than or less than comparison, // javascript coerces objects into "[object Object]". if let serde_json::Value::Object(_) = self { - return OwnedLiteral::LString("[object Object]".to_owned()).partial_compare(other); + return OwnedLiteral::LString(self.render(&Vec::new()).unwrap_or("".to_owned())) + .partial_compare(other); + } + + // When doing a greater than or less than comparison + // javascript turns arrays into strings. + if let serde_json::Value::Array(_) = self { + return OwnedLiteral::LString(self.render(&Vec::new()).unwrap_or("".to_owned())) + .partial_compare(other); } // Handle other serde_json::Value