Add the official toon-format package to your project
cargo add toon-format
Usage Example
Quick start guide for encoding and decoding TOON format in Rust
use toon_format::{encode_default, decode_default};
use serde_json::json;
fn main() -> Result<(), toon_format::ToonError> {
// Your JSON data
let data = json!({"name": "Alice", "age": 30});
// Convert to TOON format
let toon_str = encode_default(&data)?;
println!("{}", toon_str);
// Output:
// name: Alice
// age: 30
// Convert back to JSON
let json_data: serde_json::Value = decode_default(&toon_str)?;
Ok(())
}