athena_rs 3.3.0

Database gateway API
Documentation
1
2
3
4
5
6
7
8
use serde_json::Value;

// Remove nulls from a given key's array value.
pub async fn strip_nulls_from_key(root: &mut Value, key: &str) -> Option<Value> {
    let arr: &mut Vec<Value> = root.get_mut(key)?.as_array_mut()?;
    let filtered: Vec<Value> = arr.iter().filter(|v| !v.is_null()).cloned().collect();
    Some(Value::Array(filtered))
}