TOON stands for a Token-Oriented Object Notation.
It’s a new text format that has the same capability as JSON but uses less space.
It was invented to lower costs of sending data (tokens) to LLM AIs but it has 2 advantages over JSON:
- smaller than JSON
- more readable than JSON
It has implementation in many programming languages, including those I care about: JavaScript and Go.
Therefore it’s a good use for non-AI cases e.g.:
- logging structured data
- sending data from server to client
Here’s an example of JSON and TOON formats:
{
"table": "A",
"currency": "dolaramerykański",
"code": "USD",
"rates": [
{
"no": "001/A/NBP/2024",
"effectiveDate": "2024-01-02",
"mid": 3.9432
},
{
"no": "002/A/NBP/2024",
"effectiveDate": "2024-01-03",
"mid": 3.9909
},
]
}
table: A
currency: dolaramerykański
code: USD
rates[252]{no,effectiveDate,mid}:
001/A/NBP/2024,2024-01-02,3.9432
002/A/NBP/2024,2024-01-03,3.9909
As a result, I’m switching to using TOON whenever possible.