VOOZH about

URL: https://www.nuget.org/packages/ToonNet/

⇱ NuGet Gallery | ToonNet 1.0.4




👁 Image
ToonNet 1.0.4

dotnet add package ToonNet --version 1.0.4
 
 
NuGet\Install-Package ToonNet -Version 1.0.4
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ToonNet" Version="1.0.4" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ToonNet" Version="1.0.4" />
 
Directory.Packages.props
<PackageReference Include="ToonNet" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ToonNet --version 1.0.4
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ToonNet, 1.0.4"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ToonNet@1.0.4
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ToonNet&version=1.0.4
 
Install as a Cake Addin
#tool nuget:?package=ToonNet&version=1.0.4
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

ToonNet

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.

👁 NuGet


Purpose

TOON replaces verbose JSON punctuation with structured whitespace, explicit schema declarations, and optional length markers. The format is ideal when you need:

  • Lower token counts in prompts or completions sent to LLM providers.
  • Streaming-friendly logs and metrics that remain grepable.
  • Deterministic payloads that can be validated even when partially read by an agent.

How the Format Works

  1. Indentation signals nesting - scopes advance by spaces instead of braces, so parsers only track the current depth.
  2. Tabular arrays - declare a row shape once (items[2]{sku,qty}) and then emit comma, tab, or pipe separated values.
  3. Length markers - optional #3 markers tell consumers when a block will end, preventing drift in prompt streams.
  4. Key folding - single-child wrappers compact into dotted paths, but can be expanded while decoding to restore fully nested objects.

Because redundant braces and keys disappear, TOON routinely shrinks uniform payloads by 30-60 percent versus well-formatted JSON.


Installation

dotnet add package ToonNet

Quick Start

Encode

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
*/

Decode

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);

Log Example

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.


DataTable Round-Trip

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

Configuration Surface

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.


Feature Highlights

  • Token-aware serialization - reduces punctuation and repeated field names to stay within LLM context windows.
  • Deterministic and streamable - indentation plus optional #length markers keep agents from drifting when consuming partial data.
  • Human-first logging - can be tailed like plain text yet parsed like structured data.
  • Dependency-free - the package only relies on the .NET base class library.

Compatibility

  • .NET 10
  • .NET 9
  • .NET 8
  • .NET 7
  • .NET 6
  • .NET Standard 2.0 (covers .NET Framework 4.6.1+, .NET Core 2.0+, Mono, Unity)

License

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (11)

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

GitHub repositories (2)

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.
Version Downloads Last Updated
1.0.4 62,483 11/20/2025
1.0.3 677 11/17/2025
1.0.2 292 11/14/2025
1.0.1 337 11/11/2025
1.0.0 339 11/11/2025