All original content is created in Ukrainian. Not all content has been translated yet. Some posts may only be available in Ukrainian.Learn more

Why is TOON better than JSON when working with AI?

Post cover: Why is TOON better than JSON when working with AI?
Table of contentsClick link to navigate to the desired location
This content has been automatically translated from Ukrainian.
TOON format is a simple text data format that simplifies work with JSON-like structures. It is flat: each key and value is written on a separate line, without parentheses, quotation marks and complex structures.
For example, JSON
{
  "name": "Yuki",
  "age": 28,
  "skills": ["ruby", "rails", "ai"]
}
in TOON it looks like
name: Yuki
age: 28
skills: ruby, rails, ai

Why does TOON make sense when working with AI?

  1. Flat structure reduces model errors. JSON is complex: commas, parentheses, quotation marks - models sometimes skip or break them. TOON removes this "noise" and leaves only data.
  2. Fewer tokens. In large models (GPT, LLaMA, etc.), payment and speed depend on the number of tokens. JSON has a lot of syntax: parentheses, quotation marks, commas, spaces. TOON minimizes this by leaving only keys and values, which saves tokens and allows you to work with larger amounts of data without exceeding the limit.
  3. It is more convenient to whip and edit. People and models find it easier to read a flat list of keys and values. The model less often generates syntax errors and does not "break" the structure.
  4. Simple storage and analysis. TOON is easier to compare in versions, make diffs, integrate into pipelines where JSON is too bulky.
In short. TOON reduces the tokenized weight of data, makes it easier for models, and at the same time retains the ability to easily convert back into structured data. This is the optimal format for AI-configs, prompts and large arrays of structured data.

This post doesn't have any additions from the author yet.

What is Row Security in PostgreSQL and why is it Rails developers
04 Oct 19:06

What is Row Security in PostgreSQL and why is it Rails developers

meme code
meme code@memecode
What is ivar in Ruby /Rails?
19 Oct 20:12

What is ivar in Ruby /Rails?

meme code
meme code@memecode
Basic methods of authentication in the API
19 Oct 20:26

Basic methods of authentication in the API

meme code
meme code@memecode
How do OAuth 1 differ from OAuth 2
19 Oct 20:34

How do OAuth 1 differ from OAuth 2

meme code
meme code@memecode
What is ORM and why is it needed?
26 Oct 14:00

What is ORM and why is it needed?

meme code
meme code@memecode
MCP: A new internet where sites communicate with AI
04 Nov 11:43

MCP: A new internet where sites communicate with AI

meme code
meme code@memecode