Toon.NET
0.3.1
dotnet add package Toon.NET --version 0.3.1
NuGet\Install-Package Toon.NET -Version 0.3.1
<PackageReference Include="Toon.NET" Version="0.3.1" />
<PackageVersion Include="Toon.NET" Version="0.3.1" />
<PackageReference Include="Toon.NET" />
paket add Toon.NET --version 0.3.1
#r "nuget: Toon.NET, 0.3.1"
#:package Toon.NET@0.3.1
#addin nuget:?package=Toon.NET&version=0.3.1
#tool nuget:?package=Toon.NET&version=0.3.1
toon.NET
Token-Oriented Object Notation (TOON) for .NET.
Token-Oriented Object Notation is a compact, human-readable format designed for passing structured data to Large Language Models with significantly reduced token usage. It's intended for LLM input, not output.
TOON's sweet spot is uniform arrays of objects โ multiple fields per row, same structure across items. It borrows YAML's indentation-based structure for nested objects and CSV's tabular format for uniform data rows, then optimizes both for token efficiency in LLM contexts. For deeply nested or non-uniform data, JSON may be more efficient.
Think of TOON as a translation layer: use JSON programmatically, convert to TOON for LLM input.
Usage
var serializer = new ToonSerializer();
var data = new {
user = new {
id = 123,
name = "Ada",
tags = new[] { "reading", "gaming" },
active = true,
preferences = new[] { }
}
}
var dataString = serializer.Serialize(data);
Console.WriteLine(dataString);
//// example output:
// user:
// id: 123
// name: Ada
// tags[2]: reading,gaming
// active: true
// preferences[0]:
Why TOON?
AI is becoming cheaper and more accessible, but larger context windows allow for larger data inputs as well. LLM tokens still cost money โ and standard JSON is verbose and token-expensive:
{
"users": [
{ "id": 1, "name": "Alice", "role": "admin" },
{ "id": 2, "name": "Bob", "role": "user" }
]
}
TOON conveys the same information with fewer tokens:
users[2]{id,name,role}:
1,Alice,admin
2,Bob,user
Key Features
- ๐ธ Token-efficient: typically 30โ60% fewer tokens than JSON
- ๐คฟ LLM-friendly guardrails: explicit lengths and field lists help models validate output
- ๐ฑ Minimal syntax: removes redundant punctuation (braces, brackets, most quotes)
- ๐ Indentation-based structure: replaces braces with whitespace for better readability
- ๐งบ Tabular arrays: declare keys once, then stream rows without repetition
Acknowledgements
This is a port of https://github.com/johannschopplich/toon to .NET
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.3.1 | 766 | 10/30/2025 |