![]() |
VOOZH | about |
dotnet add package ToonNet --version 1.0.4
NuGet\Install-Package ToonNet -Version 1.0.4
<PackageReference Include="ToonNet" Version="1.0.4" />
<PackageVersion Include="ToonNet" Version="1.0.4" />Directory.Packages.props
<PackageReference Include="ToonNet" />Project file
paket add ToonNet --version 1.0.4
#r "nuget: ToonNet, 1.0.4"
#:package ToonNet@1.0.4
#addin nuget:?package=ToonNet&version=1.0.4Install as a Cake Addin
#tool nuget:?package=ToonNet&version=1.0.4Install as a Cake Tool
ToonNet delivers a production-ready .NET implementation of TOON (Token-Oriented Object Notation), the indentation-driven format built to minimize token usage for Large Language Models while keeping telemetry and audit logs human-readable.
TOON replaces verbose JSON punctuation with structured whitespace, explicit schema declarations, and optional length markers. The format is ideal when you need:
items[2]{sku,qty}) and then emit comma, tab, or pipe separated values.#3 markers tell consumers when a block will end, preventing drift in prompt streams.Because redundant braces and keys disappear, TOON routinely shrinks uniform payloads by 30-60 percent versus well-formatted JSON.
dotnet add package ToonNet
using ToonNetSerializer;
var payload = new
{
users = new[]
{
new { id = 1, name = "Alice", role = "admin" },
new { id = 2, name = "Bob", role = "user" }
}
};
string toon = ToonNet.Encode(payload);
/*
users[2]{id,name,role}:
1,Alice,admin
2,Bob,user
*/
using ToonNetSerializer;
const string toon = """
users[2]{id,name,role}:
1,Alice,admin
2,Bob,user
""";
var dynamicPayload = ToonNet.Decode(toon);
var typedPayload = ToonNet.Decode<UserList>(toon);
level: info
ts: 2024-05-01T10:00:00Z
service: checkout
items[2]{sku,qty}:
SKU-1,2
SKU-2,1
The same event encoded as JSON would include repeated keys, quotes, and braces, adding roughly 60 extra characters per entry and inflating LLM token counts.
using System.Data;
using ToonNetSerializer;
var table = new DataTable("Users");
table.Columns.Add("Id", typeof(int));
table.Columns.Add("Email", typeof(string));
table.Columns.Add("Active", typeof(bool));
table.Rows.Add(1, "a@example.com", true);
table.Rows.Add(2, "b@example.com", false);
var toon = ToonNet.Encode(table);
/*
tableName: "Users"
columns[3]{name,type,allowNull,unique,isPrimaryKey}:
Id,System.Int32,true,false,false
Email,System.String,true,false,false
Active,System.Boolean,true,false,false
rows[2]{Id,Email,Active}:
1,a@example.com,true
2,b@example.com,false
*/
var roundTripped = ToonNet.Decode<DataTable>(toon);
Console.WriteLine(roundTripped!.Rows.Count); // 2
Console.WriteLine(roundTripped.Rows[0]["Email"]); // a@example.com
var encodeOptions = new ToonOptions
{
Indent = 1,
Delimiter = ToonDelimiter.Tab,
UseLengthMarker = true,
KeyFolding = KeyFoldingMode.Safe,
FlattenDepth = int.MaxValue
};
var decodeOptions = new ToonDecodeOptions
{
Indent = 1,
Strict = true,
ExpandPaths = PathExpansionMode.Safe
};
Use the same option set on both sides when you need lossless round-trips across services.
#length markers keep agents from drifting when consuming partial data.MIT License. See .
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on ToonNet:
| Package | Downloads |
|---|---|
|
PRTelegramBot
An open-source framework with flexible and simple functionality for creating Telegram bots |
|
|
ThunderPropagator.BuildingBlocks
ThunderPropagator (Project ARC): High-performance data propagation; effortless, blazingly fast and cloud-native for maximum impact |
|
|
ThunderPropagator.BuildingBlocks.Debug
ThunderPropagator (Project ARC): High-performance data propagation; effortless, blazingly fast and cloud-native for maximum impact |
|
|
ThunderPropagator.BuildingBlocks.Debug.x86
ThunderPropagator (Project ARC): High-performance data propagation; effortless, blazingly fast and cloud-native for maximum impact |
|
|
ThunderPropagator.BuildingBlocks.Debug.ARM64
ThunderPropagator (Project ARC): High-performance data propagation; effortless, blazingly fast and cloud-native for maximum impact |
Showing the top 2 popular GitHub repositories that depend on ToonNet:
| Repository | Stars |
|---|---|
|
rwjdk/MicrosoftAgentFrameworkSamples
Samples demonstrating the Microsoft Agent Framework in C#
|
|
|
Cysharp/ToonEncoder
High performance Token-Oriented Object Notation (TOON) encoder for .NET.
|