Crate toon

Crate toon 

Source
Expand description

Token-Oriented Object Notation (TOON)

A compact, human-readable format designed for passing structured data to Large Language Models with significantly reduced token usage.

§Example

use toon::{encode, EncodeOptions, Delimiter};
use serde_json::json;

let data = json!({
    "items": [
        {"sku": "A1", "qty": 2, "price": 9.99},
        {"sku": "B2", "qty": 1, "price": 14.5}
    ]
});

let toon_output = encode(&data, None);
println!("{}", toon_output);
// Output:
// items[2]{price,qty,sku}:
//   9.99,2,A1
//   14.5,1,B2

Re-exports§

pub use serde_json;

Structs§

EncodeOptions
Encoding options

Enums§

Delimiter
Delimiter types for array values and tabular rows

Functions§

encode
Encode a serde_json::Value to TOON format