#json #macro #pure #compiler #deprecated #rust-serialize

json_macro

Pure json macro for rust_serialize. No need compiler features.

2 releases

Uses old Rust 2015

0.1.1 Dec 12, 2015
0.1.0 Dec 7, 2015

#115 in #deprecated


Used in way-cooler

MIT/Apache

3KB
73 lines

json_macro

Macro for rust_serialize crate realized with standard macro_rule (no needs compiler features).

Dependencies

Add this to your Cargo.toml:

[dependencies]
json_macro = "*"

and this to your crate root:

#[macro_use]
extern crate json_macro;

Usage

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
	}))
});

Dependencies

~225KB