DevOp.Toon 0.4.0

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

DevOp.Toon

Version scope: this guide covers runtime 0.3.0. It includes a runnable version-selection sample, covering official 4.4, custom hybrid rows, typed round trips, and explicit decode hints. Run it from the source tree.

TOON serialization for .NET, with a columnar format for nested business data and companion packages for API servers and HTTP clients.

Encode CLR objects, decode directly into supported DTO shapes, or work with a ToonNode graph. Use the runtime on its own or configure IToonService once through dependency injection.

Supported TOON protocol versions

Package versions and protocol versions are separate: DevOp.Toon 0.3.0 supports the following wire formats through ToonProtocolVersion from DevOp.Toon.Core 0.2.0. API 0.2.0 and Client 0.2.0 expose the same runtime choices over HTTP.

TOON protocol/profile Enum Encode Decode HTTP version value
Official 3.0 V3_0 Yes Yes 3.0
Official 4.0 V4_0 Yes Yes 4.0
Official 4.1 V4_1 Yes Yes 4.1
Official 4.2 V4_2 Yes Yes 4.2
Official 4.3 V4_3 Yes Yes 4.3
Official 4.4 V4_4 Default Yes 4.4
Legacy custom columnar CustomLegacy Yes Yes custom-legacy
Custom 4.4 grouped rows and spills CustomV4_4 Yes Yes custom-4.4
Automatic syntax detection Auto No Default Decode option only

This specifies official 3.0, not every 3.x revision. Custom profiles require compatible readers. For ambiguous input, supply a concrete decode version. When supplying decode options, match the producer's indentation or use ToonDecoder.DetectOptions(text, versionHint).

using DevOp.Toon;
using DevOp.Toon.Core;

var text = ToonEncoder.Encode(new { Id = 42 }, new ToonEncodeOptions
{
    ProtocolVersion = ToonProtocolVersion.V4_4,
    Indent = 2
});
var value = ToonDecoder.Decode(text, new ToonDecodeOptions
{
    ProtocolVersion = ToonProtocolVersion.V4_4,
    Indent = 2
});

Supported .NET targets

Package Target frameworks
Runtime, Core, Client netstandard2.0, net8.0, net9.0, net10.0
API net8.0, net10.0

Why choose this package?

See official vs custom 4.4: benefits and usage for the same nested data in both formats, measured payload/memory tradeoffs, and complete configuration examples. The runnable sample uses the published runtime, API and Client packages.

  • Keep repeated rows compact even when they contain collections. The custom columnar layout shares scalar field names in a table header and writes complex fields beneath their row. Product catalogs, warehouse snapshots, and change histories can retain a compact scalar core without flattening away their nested data.
  • Use your .NET models. Supported typed paths materialize DTOs, positional records, arrays, collection interfaces, and string-keyed dictionaries without converting through a JSON string. Other supported shapes use the native-node materializer.
  • Choose the integration layer you need. Keep model projects lightweight with the contracts package, add serialization to services, register MVC formatters at the API boundary, and use the typed HTTP client in callers.
  • Evaluate CPU, memory, and payload size together. The implementation uses pooled output buffers, cached CLR metadata, and source-backed line ranges. These techniques reduce avoidable work; they are not a claim that every payload is faster or allocates less than another serializer.

TOON benefits depend on data shape. This package is worth evaluating when repeated keys, nested collections, or large response bodies matter to your application.

Install

dotnet add package DevOp.Toon

Runtime targets: netstandard2.0, net8.0, net9.0, and net10.0.

Encode and decode typed data

using DevOp.Toon;

var source = new[]
{
    new Product(42, "Widget", new[] { "sale", "featured" }),
    new Product(43, "Gadget", new[] { "new" })
};

string text = ToonEncoder.Encode(source);
Product[] products = ToonDecoder.Decode<Product[]>(text)!;

public sealed record Product(int Id, string Name, string[] Tags);

The same runtime also reads and writes ToonNode graphs, converts JSON using Json2Toon / Toon2Json, and exposes byte, stream, and async operations. Async methods are convenience APIs; they do not imply incremental, bounded-memory parsing.

Configure once with dependency injection

using DevOp.Toon;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();
services.AddToon(options =>
{
    options.Indent = 1;
    options.Strict = true;
    options.Encode.IgnoreNullOrEmpty = false;
    options.Encode.ExcludeEmptyArrays = false;
});

using var provider = services.BuildServiceProvider();
var serializer = provider.GetRequiredService<IToonService>();
string text = serializer.Encode(new { Id = 42, Name = "Widget" });
string json = serializer.Toon2Json(text);

The package family

Package Add it to Benefit
DevOp.Toon.Core Shared models and contracts Wire-name attributes and shared enums without the serialization runtime
DevOp.Toon Applications and services Encoding, typed/DOM decoding, JSON interop, and DI
DevOp.Toon.API ASP.NET Core MVC servers TOON input/output formatters, content negotiation, and per-request response options
DevOp.Toon.Client .NET HTTP callers TOON request encoding, TOON/JSON response handling, compression configuration, and structured errors

Interoperability and data preservation

The custom columnar layout is an extension: row spill fields are not official TOON syntax. Use an official protocol mode when exchanging documents with other TOON implementations. Both ends must agree when using a custom format.

Omission settings trade data preservation for compactness. IgnoreNullOrEmpty can remove all-null/all-empty-string columns; ExcludeEmptyArrays can remove empty array properties. Set both to false when those distinctions must be retained. Binary-array formatting is another explicit policy choice; choose numeric-array output when a JSON-like array shape is required.

Version selection in 0.3.0: encoding defaults to official 4.4. Supply ToonEncodeOptions.ProtocolVersion with a concrete ToonProtocolVersion; decoding defaults to Auto and requires an explicit ToonDecodeOptions.ProtocolVersion for ambiguous version-dependent input. Select CustomLegacy for the earlier custom wire profile or CustomV4_4 for nested header groups plus row/keyed spills. Official profiles default both omission settings to false; custom profiles default them to true. Encoder options and runtime DI encoding default to one space; decode options default to two. The API integration aligns both at two spaces. See the protocol version guide for migration examples.

Performance evidence

The 6 November 2026 published-package benchmark uses all 2,051 product DTOs on .NET 10.0.13, with 30 warmups and 50 samples. Compared with legacy custom output from 0.2.9, custom 4.4 in 0.3.0 allocates 42.1% less memory during decoding and produces 3.9% fewer UTF-8 bytes; it decodes 17.0% slower in that isolated pair. The old encoder's existing numeric precision defect and intentional compact omissions are reported separately.

See current benchmark results and methodology and published-package measurements for profile-specific CPU, allocation, Auto-detection and payload-size tables. Historical April 2026 JSON comparisons remain dated separately. Measure your own data with equivalent omission settings.

DevOp.Toon combines typed decoding, JSON interop, broad .NET compatibility, custom hybrid layouts, and integration packages spanning contracts, MVC formatters, and typed HTTP clients.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 (2)

Showing the top 2 NuGet packages that depend on DevOp.Toon:

Package Downloads
DevOp.Toon.API

ASP.NET Core MVC formatters and service registration extensions for TOON payloads.

DevOp.Toon.Client

Typed HttpClient integration for TOON-first APIs with JSON fallback.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.4.0 78 11/10/2026
0.3.0 153 11/6/2026
0.2.9 207 5/25/2026
0.2.8 449 4/23/2026
0.2.7 159 4/22/2026
0.2.6 165 4/21/2026
0.2.5 127 4/19/2026
0.2.4 147 4/18/2026
0.2.3 230 4/18/2026

Adds extension data for 4.x payloads and unquoted annotation keys in custom 4.4.
- Adds [ToonExtensionData]: 4.x typed decoding captures keys that match no member into one IDictionary<string, object?> or Dictionary<string, object?> property (objects as Dictionary<string, object?>, arrays as List<object?>, numbers as double)
- Adds 4.x encoding of extension data entries as sibling keys after the declared members, including table columns and custom 4.4 row spills; a member wins any key collision
- Adds NotSupportedException for more than one extension data property or an unsupported property type; V3_0 and CustomLegacy ignore the attribute
- Improves custom 4.4 output by writing annotation keys such as @id, @metadata, $ref, @odata.context and Raven-Clr-Type without quotes ('@' and '$' anywhere, '-' after the first character); official profiles still quote them
- Updates DevOp.Toon.Core dependency to 0.3.0