Toon.DotNet
1.1.0
See the version list below for details.
dotnet add package Toon.DotNet --version 1.1.0
NuGet\Install-Package Toon.DotNet -Version 1.1.0
<PackageReference Include="Toon.DotNet" Version="1.1.0" />
<PackageVersion Include="Toon.DotNet" Version="1.1.0" />
<PackageReference Include="Toon.DotNet" />
paket add Toon.DotNet --version 1.1.0
#r "nuget: Toon.DotNet, 1.1.0"
#:package Toon.DotNet@1.1.0
#addin nuget:?package=Toon.DotNet&version=1.1.0
#tool nuget:?package=Toon.DotNet&version=1.1.0
ToonFormat for .NET
Token-Oriented Object Notation (TOON) — a compact, human-readable serialization format designed for passing structured data to Large Language Models with significantly reduced token usage. TOON shines for uniform arrays of objects and readable nested structures.
- Token-efficient alternative to JSON for LLM prompts
- Human-friendly and diff-friendly
- Strongly-typed decode support via System.Text.Json
- Strict validation options and round-trip helpers
Installation
Install from NuGet:
dotnet add package ToonFormat
Target Framework: net10.0
Quick start
using ToonFormat;
var data = new {
users = new[] {
new { id =1, name = "Alice", role = "admin" },
new { id =2, name = "Bob", role = "user" }
}
};
// Encode to TOON
string toon = Toon.Encode(data);
// users[2]{id,name,role}:
//1,Alice,admin
//2,Bob,user
// Decode to JsonElement
var json = Toon.Decode(toon);
// Decode to a typed model
var users = Toon.Decode<UserData>(toon);
public class UserData { public User[] Users { get; set; } = Array.Empty<User>(); }
public class User { public int Id { get; set; } public string Name { get; set; } = ""; public string Role { get; set; } = ""; }
API overview
Toon.Encode(object value, EncodeOptions? options = null)Toon.Decode(string input, DecodeOptions? options = null)→JsonElementToon.Decode<T>(string input, DecodeOptions? options = null, JsonSerializerOptions? jsonOptions = null)Toon.IsValid(string input, DecodeOptions? options = null)Toon.RoundTrip(object value, EncodeOptions? encodeOptions = null, DecodeOptions? decodeOptions = null)
Options
EncodeOptions
Indent— spaces per level (default:2)Delimiter— value delimiter for rows/inline arrays (default: ',')LengthMarker— optional array length marker (e.g. '#')
DecodeOptions
Indent— expected spaces per level (default:2)Strict— validate lengths/row counts and forbid stray blank lines
Customization example
var opts = new EncodeOptions {
Indent =4,
Delimiter = '|',
LengthMarker = '#'
};
var toon = Toon.Encode(data, opts);
When to use TOON
- Uniform arrays of objects (tabular data)
- Human-readable prompt payloads for LLMs
- Compact, copy/paste friendly format with stable structure
For deeply nested, highly irregular data, plain JSON may be more compact.
Samples
See examples/ToonFormat.Example for a runnable console sample.
Versioning
This project follows semantic versioning. See CHANGELOG.md for release notes.
Contributing
Contributions are welcome. See CONTRIBUTING.md and CODE_OF_CONDUCT.md.
Security
Please see SECURITY.md for reporting vulnerabilities.
License
MIT License — see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Toon.DotNet:
| Package | Downloads |
|---|---|
|
Toon.DotNet.Excel
Excel integration for ToonDotNet. Convert Excel workbooks and worksheets to and from TOON format. |
|
|
Toon.DotNet.CSV
CSV integration for ToonDotNet. Convert CSV files to and from TOON format. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Toon.DotNet:
| Repository | Stars |
|---|---|
|
Cysharp/ToonEncoder
High performance Token-Oriented Object Notation (TOON) encoder for .NET.
|
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 1.7.2 | 64,270 | 3/7/2026 | |
| 1.7.1 | 2,707 | 2/25/2026 | |
| 1.7.0 | 790 | 2/23/2026 | |
| 1.6.1 | 6,571 | 1/16/2026 | |
| 1.6.0 | 328 | 1/6/2026 | |
| 1.5.2 | 152 | 1/5/2026 | |
| 1.5.1 | 4,222 | 12/8/2025 | |
| 1.5.0 | 1,422 | 12/1/2025 | |
| 1.4.0 | 3,047 | 11/24/2025 | |
| 1.3.0 | 241 | 11/24/2025 | |
| 1.2.0 | 330 | 11/14/2025 | |
| 1.1.0 | 302 | 11/14/2025 | |
| 1.0.0 | 5,388 | 11/4/2025 |
See CHANGELOG.md for full release notes.