EonaCat.Toon 0.0.1

Prefix Reserved
dotnet add package EonaCat.Toon --version 0.0.1
                    
NuGet\Install-Package EonaCat.Toon -Version 0.0.1
                    
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="EonaCat.Toon" Version="0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EonaCat.Toon" Version="0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="EonaCat.Toon" />
                    
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 EonaCat.Toon --version 0.0.1
                    
#r "nuget: EonaCat.Toon, 0.0.1"
                    
#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 EonaCat.Toon@0.0.1
                    
#: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=EonaCat.Toon&version=0.0.1
                    
Install as a Cake Addin
#tool nuget:?package=EonaCat.Toon&version=0.0.1
                    
Install as a Cake Tool

EonaCat.Toon

Token-Oriented Object Notation (TOON) serializer for .NET.

EonaCat.Toon is a lightweight serialization library that converts .NET objects into a compact, human-readable text format designed to reduce structural overhead while preserving hierarchy and type information.

TOON is especially useful for:

  • AI and LLM prompt compression
  • Memory stores
  • Configuration files
  • Logging and telemetry
  • Human-editable structured documents
  • Lightweight data exchange

Features

Serialization

  • Primitive values
  • POCOs
  • Records
  • Anonymous types
  • Dictionaries
  • Nested objects
  • Arrays and collections
  • DataTable support
  • JsonNode compatibility

Deserialization

  • JsonNode output
  • Strongly typed models
  • Generic decoding
  • DataTable reconstruction

Compression Features

  • Tabular array encoding
  • Optional length markers
  • Key folding
  • Compact indentation
  • Multiple delimiters

Validation Features

  • Strict decoding
  • Length mismatch validation
  • Warning collection
  • Safe path expansion

Installation

dotnet add package EonaCat.Toon
Install-Package EonaCat.Toon

Quick Start

Encode

using EonaCat.Toon;

var user = new
{
    Name = "Alice",
    Age = 30
};

string toon = Toon.Encode(user);

Output:

Name: Alice
Age: 30

Decode

JsonNode? node = Toon.Decode(toonText);

Strongly Typed Decode

User? user = Toon.Decode<User>(toonText);

Public API

Encode

string output = Toon.Encode(object value);
string output = Toon.Encode(
    object value,
    EncodingOptions options);

Decode

JsonNode? node = Toon.Decode(string input);
JsonNode? node = Toon.Decode(
    string input,
    DecodingOptions options);

Generic Decode

T? value = Toon.Decode<T>(input);
T? value = Toon.Decode<T>(
    input,
    options);

TOON Syntax

Simple Values

Name: Alice
Age: 42
Active: true
Price: 12.50

Nested Objects

User:
 Name: Alice
 Address:
  City: Utrecht
  Country: Netherlands

Arrays

Tags[3]:
 AI
 DotNet
 Serialization

Length Marker Arrays

Tags[#3]:
 AI
 DotNet
 Serialization

Tabular Arrays

When all items share the same shape, TOON can store column names once.

Input:

var users = new[]
{
    new { Id = 1, Name = "Alice" },
    new { Id = 2, Name = "Bob" }
};

Output:

Users[2]{Id,Name}:
 1,Alice
 2,Bob

Benefits:

  • Smaller payloads
  • Reduced token count
  • Faster LLM ingestion
  • Easier scanning

Encoding Options

var options = new EncodingOptions
{
    Indent = 1,
    Delimiter = Delimiter.Comma,
    UseLengthMarker = true,
    KeyFolding = KeyFoldingMode.Safe,
    FlattenDepth = 5
};

Indent

Controls spaces per nesting level.

Default:

1

Delimiter

Supported values:

Delimiter.Comma
Delimiter.Tab
Delimiter.Pipe

Examples:

1,Alice
1	Alice
1|Alice

UseLengthMarker

Disabled by default.

When enabled:

Users[#10]:

instead of:

Users[10]:

KeyFolding

Supported values:

KeyFoldingMode.Off
KeyFoldingMode.Safe

Example

Input:

{
  "data": {
    "metadata": {
      "version": 1
    }
  }
}

Output:

data.metadata.version: 1

FlattenDepth

Limits maximum folding depth.

Default:

int.MaxValue

SerializerOptions

Pass custom System.Text.Json options.

new JsonSerializerOptions
{
    PropertyNamingPolicy =
        JsonNamingPolicy.CamelCase
}

NewLine

Default:

"\n"

Custom:

"\r\n"

Decoding Options

var options = new DecodingOptions
{
    Strict = true,
    ExpandPaths = PathExpansionMode.Safe
};

Strict

Default:

true

Throws exceptions when malformed structures are encountered.

ExpandPaths

Supported values:

PathExpansionMode.Off
PathExpansionMode.Safe

Expands:

data.metadata.version: 1

into:

{
  "data": {
    "metadata": {
      "version": 1
    }
  }
}

LengthMismatchBehavior

LengthMismatchBehavior.Silent
LengthMismatchBehavior.Warn
LengthMismatchBehavior.Error

WarningSink

Collect parser warnings.

var warnings =
    new List<Warning>();

options.WarningSink = warnings;

DataTable Support

Serialize

var table = new DataTable("Users");

table.Columns.Add("Id", typeof(int));
table.Columns.Add("Email", typeof(string));

table.Rows.Add(1, "alice@example.com");
table.Rows.Add(2, "bob@example.com");

string toon = Toon.Encode(table);

Deserialize

DataTable restored =
    Toon.Decode<DataTable>(toon)!;

Supported:

  • Columns
  • Rows
  • Types
  • Schema metadata

AI & LLM Usage

TOON was designed to minimize repetitive structural tokens.

Traditional JSON:

{
  "users": [
    {
      "id": 1,
      "name": "Alice"
    },
    {
      "id": 2,
      "name": "Bob"
    }
  ]
}

TOON:

users[2]{id,name}:
 1,Alice
 2,Bob

Advantages:

  • Lower token counts
  • Lower prompt costs
  • More context per request
  • Easier visual inspection

Best Practices

For AI Workloads

new EncodingOptions
{
    KeyFolding = KeyFoldingMode.Safe,
    UseLengthMarker = true,
    Indent = 1
};

For Maximum Readability

new EncodingOptions
{
    Indent = 2,
    KeyFolding = KeyFoldingMode.Off
};

For Logging

new EncodingOptions
{
    Indent = 1,
    Delimiter = Delimiter.Comma
};

Error Handling

try
{
    var model =
        Toon.Decode<MyType>(text);
}
catch (Exception ex)
{
    Console.WriteLine(ex.Message);
}

For tolerant parsing:

new DecodingOptions
{
    Strict = false,
    LengthMismatchBehavior =
        LengthMismatchBehavior.Warn
};

Framework Support

According to the project targets:

  • .NET Standard 2.0
  • .NET 6
  • .NET 7
  • .NET 8
  • .NET 9
  • .NET 10

Compatible with:

  • .NET Framework 4.6.1+
  • Mono
  • Xamarin
  • Unity

Architecture

Object
   │
   ▼
ValueEncoder
   │
   ▼
TOON Text
   │
   ▼
Scanner
   │
   ▼
ValueDecoder
   │
   ▼
JsonNode / Model

Core components:

  • ValueEncoder
  • PrimitiveEncoder
  • Scanner
  • PrimitiveParser
  • ValueDecoder
  • PathExpander
  • DataTableAdapter
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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 is compatible.  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 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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0.1 154 6/12/2026