What is tone? How token-based object notation can change how AI looks at data

by SkillAiNest

JSONor JavaScript Object Notation, was popularized by Douglas Crockford in the early 2000s. Since then, there has been no looking back. JSON has become the standard data exchange format between client and server technologies.

JSON was made for humans. It is readable, accessible, and universal for APIs to use as data or return responses. But in the modern age of AI, one downside of JSON has really come to the fore: it’s quite verbose.

Every curve, every quote, and every repetition consumes a key token. If you spend time building apps that talk to large language models (LLMs), you probably know that tokens are the currency of LLM interactions. The more tokens, the more expensive your AI solution is going to be.

Now, there’s said to be a new kid in town TOON (token-based object pointers). It promises to enable LLMs to interact with structured data in a more efficient, intelligent and cost-effective manner.

This article is the result of my curiosity in finding the tone. I wanted to learn why this is a trend, how it works, and how you can use it in your JavaScript/TypeScript and Python projects today. I hope you find it as interesting as I do.

You can find all the source code used in this article This GitHub repository.

Table of Contents

  1. What is tone?

  2. Why is tone important now?

  3. JSON vs Tone – Learn with Examples

  4. How to use Tone with JavaScript/TypeScript

  5. How to use Tone with Python?

  6. Hold on, JSON can still be better (in many cases).

  7. The future of tone

  8. Before we end…

What is tone?

Tone is a new data serialization format designed with the code goal of:

Reduce the number of tokens when exchanging structured data with language models.

Although JSON uses a verbose syntax with braces, quotation marks, and commas, Tone relies on a token-efficient tabular style, which is much closer to how LLM naturally understands structured data.

Let’s do a quick comparison between JSON and Tone:

Here’s some JSON with one users An array containing information about two users (two objects):

{
  "users": (
    { "id": 1, "name": "Alice", "role": "admin" },
    { "id": 2, "name": "Bob", "role": "user" }
  )
}

If you want to represent the same data in a tone, it looks like this:

users(2){id,name,role}:
  1,Alice,admin
  2,Bob,user

Did you notice the differences?

  • No values, braces, or colons in tone.

  • users(2){id,name,role}: Declares an array of two objects with the fields id, name, and character.

  • The lines below are just the data rows.

You can see that Tone reduced token usage by 30-50% depending on the data format.

Why is tone important now?

LLMs like GPT, Gemini, and Cloud are token-based systems. Each word, symbol, or segment costs a token for input and output. So, if you are developing an LLM with data input/output like this:

{ "products": ( ... 300, "items" ... ) }

You can waste thousands of tokens in quotes, braces, colons, and repeated keys. Tone solves this by focusing on a compact yet structured representation.

Some of the key benefits of TONE are:

  • 30-50% less tokens for the same data set.

  • It has less syntactic clutter, which makes it easier to reason about LLMS.

  • It can be nested like we do with JSON.

  • Works well with languages ​​like Python, Go, Rust, and JavaScript.

Tone is a great addition to JSON, especially for AI projects, LLMs, and data-heavy notations. It cannot completely replace JSON, but it is suitable for use cases where JSON is considered a heavyweight for data exchange.

JSON vs Tone – Learn with Examples

Now that you have a basic idea of ​​what Tone does and why it’s useful, let’s look at the most commonly used JSON structures in Tone and their equivalent representations.

1. A simple thing

Here’s how you would represent an object with JSON:

{ "name": "Alice", "age": 30, "city": "Bengaluru" }

And here’s how it works with Tone:

name: Alice
age: 30
city: Bengaluru

2. Array of values

With JSON:

{ "colors": ("red", "green", "blue") }

with tone:

colors(3): red,green,blue

3. Array of objects

With JSON:

{
  "users": (
    { "id": 1, "name": "Alice" },
    { "id": 2, "name": "Bob" }
  )
}

with tone:

users(2){id,name}:
  1,Alice
  2,Bob

here, users(2){id,name} represents the schema, and subsequent lines contain the actual data rows.

Tone schema

4. Household items

With JSON:

{
  "user": {
    "id": 1,
    "name": "Alice",
    "profile": { "age": 30, "city": "Bengaluru" }
  }
}

with tone:

user:
  id: 1
  name: Alice
  profile:
    age: 30
    city: Bengaluru

An indentation represents a nest. It’s almost like yamel, but it’s still structured.

5. Array of home farm items

With JSON:

{
  "teams": (
    {
      "name": "Team Alpha",
      "members": (
        { "id": 1, "name": "Alice" },
        { "id": 2, "name": "Bob" }
      )
    }
  )
}

with tone:

teams(1):
  - name: Team Alpha
    members(2){id,name}:
      1,Alice
      2,Bob

It’s still perfectly understandable, and much smaller than the JSON format.

Now that you know a little about the tone syntax, let’s see how to use it with different programming languages.

How to use Tone with JavaScript/TypeScript

In most cases, tone is not meant to be handwritten. Most tone data will be generated automatically by the software, or you’ll need to encode existing data (say, JSON data) into tone format.

And there is good news. Tone There is already an official npm package that you can use to convert your JSON data into and vice versa in your javascript/typescript project.

Install it using the following command:

npm install @toon-format/toon 

The easiest way to generate tone code is to convert JSON to tone. you can use encode() The above NPM package method:

import { encode } from "@toon-format/toon";

const data = {
  users: (
    { id: 1, name: "Alice", role: "admin" },
    { id: 2, name: "Bob", role: "user" },
  ),
};

const toonString = encode(data);
console.log(toonString);

Output:

users(2){id,name,role}:
  1,Alice,admin
  2,Bob,user

To do the reverse (tone => json), you need to use decode() Method:

import { decode } from "@toon-format/toon";

const toonString = `
users(2){id,name,role}:
  1,Alice,admin
  2,Bob,user
`;

const jsonObject = decode(toonString);
console.log(jsonObject);

Output:

{
  "users": (
    { "id": 1, "name": "Alice", "role": "admin" },
    { "id": 2, "name": "Bob", "role": "user" }
  )
}

You can check out This sandbox And try some encoding and decoding examples.

How to use Tone with Python

Using Tone in Python projects is as straightforward as it was with JavaScript/TypeScript. There are Python packages that can encode JSON data into a tone and return it to JSON. python-toon The package is most popular in recent times.

First, open your terminal and install it python-toon Package:

pip install python-toon

Note that if you’re in a virtual environment, you’ll need to enable it first:

python -m venv venv
source venv/bin/activate
pip install python-toon

This is it! Now you are ready to use the methods to encode and decode your data in Tone. First, let’s encode the JSON data using Python:

from toon import encode


channel = {"name": "tapaScript", "age": 2, "type": "education"}
toon_output = encode(channel)
print(toon_output)

Output:

name: tapaScript
age: 2
type: education

Similarly, we can return JSON to the tone:

from toon import decode

toon_string = """
name: tapaScript
age: 2
type: education
"""

python_struct = decode(toon_string)
print(python_struct)

Output:

{"name": "tapaScript", "age": 2, "type": "education"}

Hold on, JSON can still be better (in many cases).

Let’s be clear that Tone is not a universal replacement for JSON. In fact, you should still prefer JSON in many cases, such as:

  • Your data is deeply nested.

  • Your data is irregular (eg, different object shapes).

  • Your application requires strict schema validation or type implementation.

  • Non-AI use cases where JSON still stands and does its job just fine.

A hybrid approach may also work better. Keep JSON for your application’s data exchange format with APIs, but change the tone when it comes to sending data to LLMS.

The future of tone

The tone, although early, is still gaining a lot of attention from the developer community. Its initial attraction makes it inevitable to talk about it.

Tone has already been found:

  • Low token overhead for structured training data.

  • Compact Data Exchange in Agent Framework.

  • Fast data serialization and deserialization between MCP and AI workflow engines.

  • With serverless AI APIs, where cost and speed matter a lot.

Just as JSON has been a standard for the web’s data exchange, Tone may soon become the standard for AI data interchange. So the next time you want to quickly pass a prompt or structured data to an AI model, try it in tone format. You can see that the model gets faster and cheaper.

Before we end…

All this! I hope you find this article insightful.

Let’s get in touch:

See you soon with my next article. Until then, please take care and keep learning.

You may also like

Leave a Comment

At Skillainest, we believe the future belongs to those who embrace AI, upgrade their skills, and stay ahead of the curve.

Get latest news

Subscribe my Newsletter for new blog posts, tips & new photos. Let's stay updated!

@2025 Skillainest.Designed and Developed by Pro