# \[ANN\] ToonFormat.jl - Token-Oriented Object Notation for Julia 🔵

**URL:** <https://discourse.julialang.org/t/ann-toonformat-jl-token-oriented-object-notation-for-julia/134748>\
**Category:** Package Announcements\
**Created:** [December 26, 2025, 12:57pm UTC](https://discourse.julialang.org/t/ann-toonformat-jl-token-oriented-object-notation-for-julia/134748 "2025-12-26T12:57:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![scelles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scelles/32/220408_2.png) [@scelles](https://discourse.julialang.org/u/scelles)\
**Post date:** [December 26, 2025, 12:57pm UTC](https://discourse.julialang.org/t/ann-toonformat-jl-token-oriented-object-notation-for-julia/134748/1 "2025-12-26T12:57:06Z")

</div>

Hello Julia community!

I’m excited to announce **ToonFormat.jl** , a community-driven Julia implementation of TOON (Token-Oriented Object Notation) - a compact, human-readable serialization format optimized for LLM contexts.

📦 **GitHub:** [GitHub - toon-format/ToonFormat.jl: 🔵 Community-driven Julia implementation of TOON](https://github.com/toon-format/ToonFormat.jl)  
📚 **Documentation:** [Home · ToonFormat.jl](https://toon-format.github.io/ToonFormat.jl/dev/)

## What is TOON?

Following up on [this discussion](https://discourse.julialang.org/t/has-anyone-heard-of-toon-format-looking-for-julia-implementation/133908/4) about TOON format, we now have a fully compliant Julia implementation!

TOON is a line-oriented, indentation-based text format that encodes the JSON data model with explicit structure and minimal quoting. It achieves **30-60% token reduction** compared to JSON while maintaining readability and deterministic structure - making it ideal for LLM applications where every token counts.

## Key Features

- **Compact representation** of tabular data with 40-60% token savings
- **Minimal quoting requirements** for cleaner output
- **Explicit array lengths** for validation
- **Multiple delimiter support** (comma, tab, pipe)
- **Strict mode** for validation
- **Key folding & path expansion** for deeply nested structures
- **100% compatible** with JSON data model

## Quick Example

**JSON (156 tokens):**

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

```

**TOON (89 tokens - 43% reduction):**

```julia-auto
users[2]{id,name,role}:
  1,Alice,admin
  2,Bob,user
version: 3

```

## Usage

### Installation

```julia
using Pkg
Pkg.add("ToonFormat")

```

### Encoding

```julia
using ToonFormat

# Simple object
data = Dict("name" => "Alice", "age" => 30)
toon_str = ToonFormat.encode(data)
# name: Alice
# age: 30

# Tabular arrays
users = [
    Dict("id" => 1, "name" => "Alice", "role" => "admin"),
    Dict("id" => 2, "name" => "Bob", "role" => "user")
]
toon_str = ToonFormat.encode(Dict("users" => users))
# users[2]{id,name,role}:
# 1,Alice,admin
# 2,Bob,user

```

### Decoding

```julia
using ToonFormat

input = "name: Alice\nage: 30"
data = ToonFormat.decode(input)
# Dict("name" => "Alice", "age" => 30)

```

### Advanced: Key Folding

```julia
# Deep nesting made compact
data = Dict("api" => Dict("v1" => Dict("users" => Dict("endpoint" => "/api/v1/users"))))

options = ToonFormat.EncodeOptions(keyFolding="safe")
ToonFormat.encode(data, options=options)
# api.v1.users.endpoint: /api/v1/users

```

## Specification Compliance

✅ **FULLY COMPLIANT with TOON Specification v3.0**

- **2090+ passing tests** covering all normative requirements
- **349/349 official fixture tests** passing (100%)
- Complete round-trip compatibility
- All primitive types, tabular arrays, nested structures, and error conditions validated

## Performance

| Data Type | Token Reduction |
| --- | --- |
| Tabular data | 40-60% |
| Nested objects | 20-40% |
| Mixed structures | 30-50% |

## Contributing

Contributions are welcome! The repository includes comprehensive tests and documentation. See [CONTRIBUTING.md](https://github.com/toon-format/ToonFormat.jl/blob/main/CONTRIBUTING.md) for guidelines.

## Related Resources

- [TOON Specification v3.0](https://github.com/toon-format/spec/blob/main/SPEC.md)
- [TypeScript/JavaScript Implementation](https://github.com/toon-format/toon)
- [Original discussion by Johann Schopplich](https://www.linkedin.com/feed/update/urn:li:activity:7389343359892402176/)

## License

MIT License © 2025 TOON Format Organization

* * *

Special thanks to [@johannschopplich](https://github.com/johannschopplich) for creating the TOON specification and to everyone who showed interest in bringing this to Julia!

Feedback, issues, and contributions are very welcome. Looking forward to hearing your thoughts! 🚀

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [December 26, 2025, 4:56pm UTC](https://discourse.julialang.org/t/ann-toonformat-jl-token-oriented-object-notation-for-julia/134748/2 "2025-12-26T16:56:53Z")

</div>

Since TOON is basically just CSV with some additional metadata, can’t you use an optimized CSV package like CSV.jl to do the actual data reading/writing?

---

<div class="post-metadata">

**Author:** ![scelles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scelles/32/220408_2.png) [@scelles](https://discourse.julialang.org/u/scelles)\
**Post date:** [December 26, 2025, 6:30pm UTC](https://discourse.julialang.org/t/ann-toonformat-jl-token-oriented-object-notation-for-julia/134748/3 "2025-12-26T18:30:42Z")

</div>

We are open to contributions (especially performance metrics to show current status of implementation and see how it can be improved thanks to CSV.jl)

---

<div class="post-metadata">

**Author:** ![JesperMartinsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jespermartinsson/32/34098_2.png) [@JesperMartinsson](https://discourse.julialang.org/u/JesperMartinsson)\
**Post date:** [December 28, 2025, 9:01am UTC](https://discourse.julialang.org/t/ann-toonformat-jl-token-oriented-object-notation-for-julia/134748/4 "2025-12-28T09:01:21Z")

</div>

Interesting, but would a CSV approach also work for nested objects?

---

<div class="post-metadata">

**Author:** ![scelles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scelles/32/220408_2.png) [@scelles](https://discourse.julialang.org/u/scelles)\
**Post date:** [December 28, 2025, 9:10am UTC](https://discourse.julialang.org/t/ann-toonformat-jl-token-oriented-object-notation-for-julia/134748/5 "2025-12-28T09:10:26Z")

</div>

I think a hybrid approach would be necessary in such a case ie CSV approach for pure tabular data and indentation-based approach for nesting.

---

<div class="post-metadata">

**Author:** ![scelles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scelles/32/220408_2.png) [@scelles](https://discourse.julialang.org/u/scelles)\
**Post date:** [January 31, 2026, 8:23pm UTC](https://discourse.julialang.org/t/ann-toonformat-jl-token-oriented-object-notation-for-julia/134748/6 "2026-01-31T20:23:49Z")

</div>

“Are LLMs Ready for TOON?” may be worth reading

> **[Are LLMs Ready for TOON? Benchmarking Structural Correctness–Sustainability...](https://arxiv.org/html/2601.12014)**
