Large Language Models (LLMs) charge based on token usage. TOON (Token-Oriented Object Notation) reduces token count by 30-60% compared to JSON, directly translating to significant cost savings in LLM API calls.
30-60%
Reduction in token usage compared to JSON format
Up to 60%
Potential savings on LLM API costs
Enhanced
Explicit schemas improve LLM parsing accuracy
TOON removes brackets, braces, and repeated keys that add tokens without adding information. For example, JSON uses quotes around every key and value, while TOON only uses quotes when necessary.
JSON:
{"id": 1, "name": "Alice"}TOON:
id: 1
name: AliceUniform arrays are represented in a compact tabular format with field headers declared once, eliminating repeated keys for each object.
JSON (45 tokens):
{
"users": [
{"id": 1, "name": "Alice"},
{"id": 2, "name": "Bob"}
]
}TOON (18 tokens):
users[2]{id,name}:
1,Alice
2,BobTOON includes explicit array lengths and field headers, providing clear schemas that enhance parsing reliability and accuracy in LLMs, reducing the need for additional context.
Convert JSON to TOON before sending to LLM APIs, then convert responses back to JSON for external interfaces.
TOON's tabular format works best with arrays of objects that have the same structure. Ensure your data is normalized before conversion.
Track the token reduction percentage for your specific data to understand actual cost savings.
Verify that your LLM provider can parse TOON format correctly, or use our converter to switch between formats as needed.
Your application receives or generates JSON data as usual.
Use our JSON to TOON converter to transform the data into the compact TOON format.
Send the TOON-formatted data to your LLM API, reducing token usage and costs.
If the LLM returns TOON format, convert it back to JSON for standard processing.