While JSON is the de facto standard for data interchange on the web, it was not designed with LLM token efficiency in mind. TOON, on the other hand, was created specifically for this purpose. Here's a comparison of the two formats:
{
"users": [
{ "id": 1, "name": "Alice", "role": "admin" },
{ "id": 2, "name": "Bob", "role": "user" }
]
}
users
id, name, role
1, Alice, admin
2, Bob, user
As you can see, TOON is much more concise than JSON. This is because it removes redundant characters like curly braces, square brackets, and commas. It also consolidates the keys into a single header row, which significantly reduces the number of tokens.