This is a web-based example demonstrating the TOON serialization format using WebAssembly.
Try the live demo on GitHub Pages →
- Convert JSON to TOON format
- Convert TOON to JSON format
- Interactive web interface with syntax highlighting
- Support for pipe (|) and comma (,) delimiters
- Strict mode validation
- Multiple example templates
Install wasm-pack:
cargo install wasm-packFrom the repository root:
./examples/web/build.shOr manually:
wasm-pack build crates/toon-wasm --target web --out-dir ../../examples/web/pkgThe web demo is automatically deployed to GitHub Pages on every push to the main branch. The deployment workflow builds the WASM module and publishes it to https://jimmystridh.github.io/toon-rs/
After building, serve the examples/web directory with any HTTP server:
# Using Python 3
cd examples/web
python3 -m http.server 8000
# Using Python 2
python -m SimpleHTTPServer 8000
# Using Node.js http-server
npx http-server -p 8000Then open http://localhost:8000 in your browser.
- JSON to TOON: Enter JSON in the left panel and click "JSON → TOON"
- TOON to JSON: Enter TOON in the right panel and click "TOON → JSON"
- Try Examples: Click any example button to load sample data
- Options:
- Pipe delimiter: Use
|instead of,for tabular arrays - Strict mode: Enable strict validation during encoding/decoding
- Pretty JSON: Format JSON output with indentation
- Pipe delimiter: Use
TOON (Token-Oriented Object Notation) is a human-readable, token-efficient alternative to JSON designed for LLM data exchange. It uses indentation-based structure and supports tabular arrays for efficient representation of structured data.
Example:
JSON:
{
"users": [
{"id": 1, "name": "Alice", "age": 30},
{"id": 2, "name": "Bob", "age": 25}
]
}TOON:
users:
@| id | name | age
| 1 | Alice | 30
| 2 | Bob | 25