Macro serde_json_lodash::flatten_deep[][src]

macro_rules! flatten_deep {
    () => { ... };
    ($a:expr $(,)*) => { ... };
    ($a:expr, $($rest:tt)*) => { ... };
}

Description can be found in lodash flattenDeep

Examples:

#[macro_use] extern crate serde_json_lodash;
use serde_json::json;
assert_eq!(
  flatten_deep!(json!([1, [2, [3, [4]], 5]])),
  json!([1, 2, 3, 4, 5])
);

More examples:

assert_eq!(flatten_deep!(), json!([]));
assert_eq!(flatten_deep!(json!(null)), json!([]));
assert_eq!(flatten_deep!(json!(false)), json!([]));
assert_eq!(flatten_deep!(json!(0)), json!([]));
assert_eq!(flatten_deep!(json!("")), json!([]));
assert_eq!(flatten_deep!(json!("ab")), json!(["a","b"]));
assert_eq!(flatten_deep!(json!("りしれ")), json!(["り","し","れ"]));
assert_eq!(flatten_deep!(json!({})), json!([]));
assert_eq!(flatten_deep!(json!({"a":1})), json!([]));
assert_eq!(flatten_deep!(json!([null,false,0,"",[null,[false]],{"a":1}])), json!([null,false,0,"",null,false,{"a":1}]));