From 3e08f3b72bae236782078b0d6c67c3e2f25c6295 Mon Sep 17 00:00:00 2001 From: Johann Schopplich Date: Sun, 16 Nov 2025 19:30:06 +0100 Subject: [PATCH] docs: overhaul TOON example --- README.md | 49 ++++++++++++++++++------------------------------- 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 8757062..049219d 100644 --- a/README.md +++ b/README.md @@ -37,15 +37,7 @@ Think of it as a translation layer: use JSON programmatically, and encode it as ## Why TOON? -AI is becoming cheaper and more accessible, but larger context windows allow for larger data inputs as well. **LLM tokens still cost money** – and standard JSON is verbose and token-expensive. TOON offers a more compact alternative: - - - - - - - - - - -
JSONTOON
+AI is becoming cheaper and more accessible, but larger context windows allow for larger data inputs as well. **LLM tokens still cost money** – and standard JSON is verbose and token-expensive: ```json { @@ -84,29 +76,8 @@ AI is becoming cheaper and more accessible, but larger context windows allow for } ``` - - -```toon -context: - task: Our favorite hikes together - location: Boulder - season: spring_2025 - -friends[3]: ana,luis,sam - -hikes[3]{id,name,distanceKm,elevationGain,companion,wasSunny}: - 1,Blue Lake Trail,7.5,320,ana,true - 2,Ridge Overlook,9.2,540,luis,false - 3,Wildflower Loop,5.1,180,sam,true -``` - -
-
-YAML already achieves fewer tokens than JSON, but TOON goes further. +YAML already conveys the same information with fewer tokens. ```yaml context: @@ -142,6 +113,22 @@ hikes:
+TOON conveys the same information with **even fewer tokens** – combining YAML-like indentation with CSV-style tabular arrays: + +```toon +context: + task: Our favorite hikes together + location: Boulder + season: spring_2025 + +friends[3]: ana,luis,sam + +hikes[3]{id,name,distanceKm,elevationGain,companion,wasSunny}: + 1,Blue Lake Trail,7.5,320,ana,true + 2,Ridge Overlook,9.2,540,luis,false + 3,Wildflower Loop,5.1,180,sam,true +``` + ## Key Features - 💸 **Token-efficient:** typically 30-60% fewer tokens on large uniform arrays vs formatted JSON[^1]