Skip to the content.

TOON (Transparent Object-Oriented Notation)

Information

TOON (Transparent Object-Oriented Notation) is a data serialization format designed to be as easy for machines to read as it is for humans, while focusing on being ambiguity-free and hierarchical. It is particularly relevant in the context of Large Language Models (LLMs) and AI agents as an alternative to JSON, YAML, and TOML.

Why TOON for AI?

Compared to other formats, TOON offers several advantages for AI workflows:

Comparison

Criterion LISP JSON YAML TOML JS TOON
Ambiguity-free ⚠️ ⚠️ ⚠️
Intent clarity ⚠️ ⚠️ ⚠️
Hierarchy ⚠️ ⚠️ ⚠️
AI-friendly ⭐⭐⭐⭐⭐ ⭐⭐ ⭐⭐ ⭐⭐
Risk of storytelling ⚠️ ⚠️ ⚠️
Suitable as DSL ⚠️

Usage and Syntax

TOON syntax is minimalist, using braces for hierarchy and avoiding unnecessary punctuation.

Basic Example

person {
    name "John Doe"
    age 30
    active true
}

Nested Objects

project {
    title "AI Assistant"
    meta {
        version "1.0.0"
        author "Junie"
    }
    tasks [
        "Plan implementation"
        "Write code"
        "Verify results"
    ]
}

Integration with LLMs

When using TOON with LLMs, it is often helpful to provide a few-shot example in the system prompt to define the expected format. Its lack of commas makes it particularly robust for models that tend to struggle with strict JSON syntax in long outputs.

See also