fix: .flat() returning empty arrays

This commit is contained in:
əlemi 2024-03-21 01:09:54 +01:00
parent 30637f93ee
commit 45c5ea69a6
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -66,7 +66,8 @@ impl<T : super::Base> Node<T> {
arr
.into_iter()
.filter_map(|node| match node {
Node::Empty | Node::Link(_) => None,
Node::Empty => None,
Node::Link(l) => Some(serde_json::Value::String(l.href().to_string())),
Node::Object(o) => Some(o.underlying_json_object()),
Node::Array(_) => Some(serde_json::Value::Array(node.flat())),
}).collect()