Crates.io | json_macro |
lib.rs | json_macro |
version | 0.1.1 |
source | src |
created_at | 2015-12-07 08:58:48.058157 |
updated_at | 2015-12-15 00:03:39.936387 |
description | Pure json macro for rust_serialize. No need compiler features. |
homepage | https://github.com/DenisKolodin/json_macro |
repository | https://github.com/DenisKolodin/json_macro |
max_upload_size | |
id | 3587 |
size | 3,008 |
Macro for rust_serialize crate realized with standard macro_rule (no needs compiler features).
Add this to your Cargo.toml
:
[dependencies]
json_macro = "*"
and this to your crate root:
#[macro_use]
extern crate json_macro;
Use macro this way:
let s = json!("string");
let f = json!(3.1f64);
let a = json!([1,2,3,4,5]);
let o = json!({
"one" => 1,
"sub" => (json!({
"two" => 2
}))
});