| Crates.io | totoon |
| lib.rs | totoon |
| version | 0.1.1 |
| created_at | 2025-11-15 20:33:07.242161+00 |
| updated_at | 2025-11-15 20:45:52.227857+00 |
| description | Convert any data format to TOON (Token-Oriented Object Notation) |
| homepage | |
| repository | https://github.com/bug4fix/totoon |
| max_upload_size | |
| id | 1934744 |
| size | 21,548 |
totoon - Convert any data format to TOON (Token-Oriented Object Notation) for Rust
Add this to your Cargo.toml:
[dependencies]
totoon = "0.1.0"
serde_json = "1.0"
use totoon::to_toon;
use serde_json::json;
fn main() {
// Convert JSON value to TOON
let data = json!({
"users": [
{"name": "Alice", "age": 30},
{"name": "Bob", "age": 25}
]
});
let toon_output = to_toon(&data);
println!("{}", toon_output);
}
Output:
users[2]{name,age}:
Alice,30
Bob,25
use totoon::json_to_toon;
let json_str = r#"{"name": "Alice", "age": 30}"#;
let toon_output = json_to_toon(json_str).unwrap();
println!("{}", toon_output);
to_toon(value: &Value) -> StringConvert a serde_json::Value to TOON format.
to_toon_with_indent(value: &Value, indent: usize, level: usize) -> StringConvert a serde_json::Value to TOON format with custom indentation.
json_to_toon(json_str: &str) -> Result<String, serde_json::Error>Convert JSON string to TOON format.
MIT