blob: e5ad212f47549a882ca347a7e6b4161e9c1a6733 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
#[derive(Serialize)]
struct Foo {
bar: i32
}
fn main() {
let s = serde_json::to_string(&Foo { bar: 42 })
.expect("Unable to serialize foo");
println!("{}", s);
}
|