Discover and explore top open-source AI tools and projects—updated daily.
toon-formatCompact data format for LLMs
New!
Top 5.6% on SourcePulse
Token-Oriented Object Notation (TOON) is a compact, human-readable data format designed to drastically reduce token usage when passing structured data to Large Language Models (LLMs). It targets developers and power users who frequently send large datasets to LLMs and seek to lower costs and improve efficiency. TOON offers a significant reduction in token count, typically between 30-60%, compared to standard JSON.
How It Works
TOON merges YAML's indentation-based structure for nested objects with CSV's tabular format for uniform data rows, optimizing for LLM contexts. It minimizes token overhead by removing redundant punctuation like braces, brackets, and most quotes, relying instead on whitespace and explicit declarations. Tabular arrays are a key feature, allowing keys to be declared once, followed by streamed rows without repetition, further enhancing token efficiency.
Quick Start & Requirements
npm install @byjohann/toon (also supports pnpm and yarn).import { encode } from '@byjohann/toon'
const data = {
  user: {
    id: 123,
    name: 'Ada',
    tags: ['reading', 'gaming'],
    active: true,
    preferences: []
  }
}
console.log(encode(data))
This example demonstrates encoding a nested object with primitive arrays and empty arrays, resulting in a TOON string.Highlighted Details
\t), and pipe (|) delimiters for arrays, offering flexibility and potential further token savings.Maintenance & Community
The provided README does not contain specific information regarding maintainers, community channels (e.g., Discord, Slack), or project roadmaps.
Licensing & Compatibility
Limitations & Caveats
Token savings are dependent on the specific LLM tokenizer used; benchmarks are based on GPT-style tokenizers. The efficient tabular array format requires all objects within an array to have identical key sets and only primitive values; deviations will cause TOON to fall back to a more verbose list format. TOON is optimized for LLM contexts and is not a direct drop-in replacement for JSON in general-purpose programming scenarios.
7 hours ago
Inactive
romansky
magpie-align
noamgat
eyurtsev
ray-project