Macro serde_json_lodash::to_string
source · [−]macro_rules! to_string {
() => { ... };
($a:expr $(,)*) => { ... };
($a:expr, $($rest:tt)*) => { ... };
}
Expand description
Based on to_string()
Examples:
#[macro_use] extern crate serde_json_lodash;
use serde_json::json;
assert_eq!(
to_string!(json!(null)),
json!("")
);
assert_eq!(
to_string!(json!(-0)),
json!("0") // In rust world, -0 is 0
);
assert_eq!(
to_string!(json!([1, 2, 3])),
json!("1,2,3")
);
More examples:
assert_eq!(to_string!(), json!(""));
assert_eq!(to_string!(json!(null)), json!(""));
assert_eq!(to_string!(json!(false)), json!("false"));
assert_eq!(to_string!(json!(-0)), json!("0")); // rust world -0 is 0
assert_eq!(to_string!(json!("")), json!(""));
assert_eq!(to_string!(json!([])), json!(""));
assert_eq!(to_string!(json!([null,"A",{}])), json!("null,A,serde_json::map::Map<alloc::string::String, serde_json::value::Value>"));
assert_eq!(to_string!(json!({})), json!("serde_json::map::Map<alloc::string::String, serde_json::value::Value>"));