Back to Newsroom
Developer Stories

Beyond JSON: How TOON Can Cut Your LLM API Costs by 50%

The verbosity of JSON is costing your team money. Learn how Token-Oriented Object Notation (TOON) can reduce your LLM API token usage for structured data by up to 50%.

December 10, 2025
2 min read
Adrian Mönke
Adrian Mönke
Co-Founder & Product Lead
Article featured image

The Token Tax: Why Your Structured Data is Killing Your Budget

For two decades, JSON (JavaScript Object Notation) has been the universal language of the web. It's human-readable, simple, and the gold standard for API data exchange.

But as LLMs came up they have exposed a costly flaw in JSON: It is incredibly verbose.

In the world of LLMs, every character-every brace, every quote, every comma, and every repeated key-is converted into tokens. Tokens are the currency of AI. If you're passing a large array of uniform structured data (like a list of 50 users or 100 products) to an LLM for summarization, reasoning, or function calling, you are paying a massive Token Tax simply to transmit syntactic clutter.

We need a format that is:

  1. Still human-readable.
  2. Optimized for LLM consumption (i.e., token-efficient).
  3. Easy to implement in modern tech stacks.

Enter TOON (Token-Oriented Object Notation).

What is TOON? A Token-Efficient Serialization Format

TOON is a new data serialization specification designed with one primary goal: To drastically reduce the token count when exchanging structured data with AI.

Instead of relying on the verbose, character-based syntax of JSON, TOON uses a compact, tabular style that aligns closely with how LLMs naturally process organized information.

JSON vs. TOON: The Side-by-Side View

The most immediate benefit is clear when comparing a common structure: an array of objects.

JSON: 51 tokens (approx.) vs. TOON: 20 tokens (approx.)

Here is the data for two users, first in JSON, then in TOON:

JSON Representation

1
{
2
"users": [
3
{ "id": 1, "name": "Alice", "role": "admin" },
4
{ "id": 2, "name": "Bob", "role": "user" }
5
]
6
}

TOON Representation

1
users[2]{id,name,role}:
2
1,Alice,admin
3
2,Bob,user

The Mechanics: Schema Declaration

Notice the critical difference in the TOON format:

  • users[2]{id,name,role}:

This single line is the Schema Declaration. It tells the parser (and the LLM):

  • users: The key name for the object.
  • [2]: This is an array with 2 elements.
  • {id,name,role}: The fields that apply to every element in the array.

The subsequent lines simply become data rows, removing every repeated key, quote, colon, and brace-achieving token savings of 30% to 50% for uniform data sets.

The Developer Value: Speed, Cost, and Smarter AI

For developers, the move to TOON isn't just a philosophical choice; it delivers quantifiable benefits:

  1. Lower API Costs: Fewer tokens in your prompts and LLM responses mean you directly reduce the operational cost of your AI service.
  2. Faster Performance: With less data to parse and generate, serialization and deserialization times are quicker, improving end-to-end latency.
  3. Smarter LLM Reasoning: The lack of syntactic clutter makes it easier for the LLM to focus on the data's content and structure, improving its ability to reason about the information provided.

How to Start Using TOON Today (Practical Implementation)

You don't need to hand-write TOON. Official packages are available to automatically encode your existing data structures (like JSON objects) into the TOON format and decode them back.

JavaScript/TypeScript

Use the official NPM package to start converting JSON data instantly:

1
npm install @toon-format/toon
1
import { encode, decode } from "@toon-format/toon";
2
3
const jsonData = {
4
channel: { name: "tapaScript", type: "education" }
5
};
6
7
// JSON => TOON
8
const toonString = encode(jsonData);
9
console.log(toonString);
10
/* Output:
11
name: tapaScript
12
type: education
13
*/
14
15
// TOON => JSON
16
const jsonObject = decode(toonString);

Python

The python-toon package makes implementation just as straightforward:

1
pip install python-toon
1
from toon import encode, decode
2
3
# JSON => TOON
4
channel = {"name": "dataPipeline", "version": 1.0}
5
toon_output = encode(channel)
6
print(toon_output)
7
"""
8
Output:
9
name: dataPipeline
10
version: 1.0
11
"""
12
13
# TOON => JSON
14
python_struct = decode(toon_output)

Caveat: When to Stick with JSON

TOON is an augmentation to JSON, not a universal replacement. JSON is still superior when:

  • Data is Deeply Nested: Nested structures become less efficient in TOON.
  • Data is Highly Irregular: If your objects frequently have different keys, the core advantage of TOON's schema declaration is lost.
  • Non-AI Use Cases: For standard web APIs where human readability and universal support are paramount, stick with JSON.

The smartest approach is often a hybrid model: Use JSON for application-to-application data transfer, but convert it to TOON only when sending that structured data to your LLM endpoints.

A Final Note on Code Stability

Optimizing your data formats is critical for controlling cost and performance. Equally critical is ensuring the quality and integrity of the code those LLMs are generating and interacting with.

At Olymp Labs, we are building the security engine for developers. We help your team enforce the core patterns that guarantee scalability, maintainability, security, and compliance - turning fast, functional code into production-ready software.

Next time you're optimizing an AI-driven service, give TOON a try. And if you need help securing the resulting code, let's talk.