2 releases

Uses old Rust 2015

0.1.1 May 13, 2015
0.1.0 Apr 21, 2015

#16 in #again

MIT license

7KB
160 lines

tomson

Build Status

toml to json and back again.

docs

Find them here

install

Add the following to your Cargo.toml

[dependencies]
tomson = "0.1.1"

Doug Tangren (softprops) 2015


lib.rs:

tomson provides conversions from Toml to Json and Json to Toml

Example

let toml = r#"
[foo]
bar = 1
"#;

let json = r#"
{"foo":{"bar":1}}
"#;

match tomson::Toml::as_json(&mut toml.to_string()) {
    Ok(json) => println!("json -> {:?}", json),
    Err(e)   => println!("invalid toml -> {:?}", e)
};

match tomson::Json::as_toml(&mut json.to_string()) {
  Ok(toml) => println!("toml -> {:?}", toml),
  Err(e)   => println!("invalid json -> {:?}", e)
};

Dependencies

~370KB