# Macro json::object [−] [src]

    macro_rules! object {
        {} => { ... };
        (@ENTRY($( $k:expr => $v:expr, )*) $key:ident: $( $cont:tt )*) => { ... };
        (@ENTRY($( $k:expr => $v:expr, )*) $key:literal: $( $cont:tt )*) => { ... };
        (@ENTRY($( $k:expr => $v:expr, )*) [$key:expr]: $( $cont:tt )*) => { ... };
        (@ENTRY($( $k:expr => $v:expr, )*) $key:expr => $value:tt, $( $cont:tt )+) => { ... };
        (@ENTRY($( $k:expr => $v:expr, )*) $key:expr => $value:tt,) => { ... };
        (@ENTRY($( $k:expr => $v:expr, )*) $key:expr => $value:tt) => { ... };
        (@ENTRY($( $k:expr => $v:expr, )*) $key:expr => $value:expr, $( $cont:tt )+) => { ... };
        (@ENTRY($( $k:expr => $v:expr, )*) $key:expr => $value:expr,) => { ... };
        (@ENTRY($( $k:expr => $v:expr, )*) $key:expr => $value:expr) => { ... };
        (@END $( $k:expr => $v:expr, )*) => { ... };
        ($key:tt: $( $cont:tt )+) => { ... };
        ($( $k:expr => $v:expr, )*) => { ... };
        ($( $k:expr => $v:expr ),*) => { ... };
    }

Helper macro for creating instances of `JsonValue::Object`.

    let data = object!{
        foo: 42,
        bar: false,
    };

    assert_eq!(data["foo"], 42);
    assert_eq!(data["bar"], false);

    assert_eq!(data.dump(), r#"{"foo":42,"bar":false}"#);