TOON Spec v4.4
Implements TOON spec v4.4, passes all 564 official conformance fixtures and writes the same text as the official .NET library. TOON is a compact, human-readable format that suits LLM prompts, configuration files and data exchange.
Familiar API
A System.Text.Json-style ToonSerializer with options, attributes and custom converters, plus a ToonDocument/ToonValue model for working with TOON directly. Builds for .NET 8 and .NET 10, tested on .NET 11.
Source Generator
Mark a partial type with [ToonSerializable] and the generator adds static Serialize/Deserialize methods. ToonSerializer uses the generated code for those types automatically.
JSON and YAML
Convert between TOON and JSON with ToonConvert (System.Text.Json), and between TOON and YAML with ToonYamlConvert (YamlDotNet).
ASP.NET Core
MVC input and output formatters for application/toon and text/toon, dependency injection registration with AddToonNet, and a TOON configuration provider with AddToonFile.
Async and Streaming
Async APIs for strings, streams and files, and multi-document streaming that writes large collections in batches and reads them back one item at a time with SerializeDocumentsAsync and DeserializeDocumentsAsync.
Quick Example
Get started with ToonNet in seconds. No configuration needed.
dotnet add package ToonNet.Coreusing ToonNet.Core.Serialization;
// Serialize
var person = new Person { Name = "Alice", Age = 30 };
string toon = ToonSerializer.Serialize(person);
// Deserialize
var restored = ToonSerializer.Deserialize<Person>(toon);
public class Person
{
public string Name { get; set; } = "";
public int Age { get; set; }
}TOON Format Output
Clean, readable, and token-efficient data format.
Name: Alice
Age: 30The same data as JSON:
{
"Name": "Alice",
"Age": 30
}