totoon (Rust)
totoon - Convert any data format to TOON (Token-Oriented Object Notation) for Rust
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
= "1.0"
Usage
use to_toon;
use json;
Output:
users[2]{name,age}:
Alice,30
Bob,25
Convert from JSON String
use json_to_toon;
let json_str = r#"{"name": "Alice", "age": 30}"#;
let toon_output = json_to_toon.unwrap;
println!;
API
to_toon(value: &Value) -> String
Convert a serde_json::Value to TOON format.
to_toon_with_indent(value: &Value, indent: usize, level: usize) -> String
Convert 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.
License
MIT