macro_rules! object { () => { ... }; ($($tt:tt)+) => { ... }; }
Expand description
Construct a sonic_rs::value::Object
from a JSON object literal.
let code = 200;
let features = vec!["sonic_rs", "json"];
let object = object! {
"code": code,
"success": code == 200,
"payload": {
"features": features,
features[0]: features[1]
}
};
assert_eq!(object["code"], 200);
assert_eq!(object["payload"]["features"][0], "sonic_rs");