macro_rules! object { {} => { ... }; { $( $key: ident : $value: expr ),* $(,)? } => { ... }; }
Expand description
Create a json-like ‘object’: A map of string keys to json values
unreact::Object is a type alias for serde_json::Map<String, serde_json::Value>
Similar to serde_json::json! macro, but must be an object
Examples
object! {
foo: 123,
bar: vec![4, 5, 6],
// Nested objects must also use `object!` macro
nested: object! {
key: "value"
}
};The above code is equivalent to this json:
{
"foo": 123,
"bar": [4, 5, 6],
"nested": {
"key": "value"
}
}