DevOp.Toon.API 0.2.0

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

DevOp.Toon.API

ASP.NET Core MVC input/output formatters for application/toon and text/toon, using the DevOp.Toon runtime. Targets .NET 8 and .NET 10.

Version scope: this guide covers API 0.2.0 with runtime 0.3.0 and Core 0.2.0.

dotnet add package DevOp.Toon.API
using DevOp.Toon.API;
using DevOp.Toon.Core;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers().AddToon(options =>
{
    options.Encode.ProtocolVersion = ToonProtocolVersion.V4_4;
});
var app = builder.Build();
app.MapControllers();
app.Run();

Defaults and migration

AddToon() encodes official 4.4 with two-space indentation, comma delimiters, key folding off, and both IgnoreNullOrEmpty and ExcludeEmptyArrays false. Byte sequences use Base64String. Decoding defaults to Auto; ambiguous version-dependent input requires an explicit version hint.

The previous compact custom profile is no longer the default. Select ToonProtocolVersion.CustomLegacy to retain the legacy custom wire format, or CustomV4_4 for the new custom format with nested header groups and row/keyed spills. Both custom profiles default the two omission options to true; set both false when null, empty-string, and empty-array distinctions must be retained. Explicit option values remain effective when changing versions. Custom payloads require compatible readers at both ends.

HTTP version contract

Header Meaning
Request X-Toon-Version: 4.4 Version of the request body; selects input decoding.
Request X-Toon-Option-ProtocolVersion: custom-4.4 Requested version of the response; independent of the request body version.
Response X-Toon-Version: custom-4.4 Actual version used for the TOON response body.

Supported concrete wire names are 3.0, 4.0, 4.1, 4.2, 4.3, 4.4, custom-legacy, and custom-4.4. Auto is a decode policy and cannot be supplied as a wire version or used for encoding.

All supplied X-Toon-Option-* headers and version headers are validated before model binding/body consumption. Malformed, multiple, or conflicting body versions return 400; a well-formed unsupported body version returns 415. A malformed response-version request returns 400; a well-formed unsupported response version returns 406. Version validation errors use application/problem+json. A configured explicit decoder version must agree with the body header.

POST /products
Content-Type: application/toon
Accept: application/toon
X-Toon-Version: 4.4
X-Toon-Option-ProtocolVersion: custom-4.4
X-Toon-Option-Indent: 2
X-Toon-Option-IgnoreNullOrEmpty: false
X-Toon-Option-ExcludeEmptyArrays: false

X-Toon-Option-Indent is an integer number of spaces from 1 through 16; boolean values and values outside this range return 400. This HTTP input limit is separate from trusted direct runtime configuration.

Other X-Toon-Option-* headers apply response encode options only for that request. For example, X-Toon-Option-ByteArrayFormat: NumericArray selects numeric byte arrays. These overlays do not mutate the registered service options.

Compression

AddToon() adds both TOON media types to response compression options. Enable middleware in the host when compression is desired:

builder.Services.AddResponseCompression();
// After builder.Build(), before mapping controllers:
app.UseResponseCompression();

Source and further notes: DevOp.Toon.API repository.

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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. 
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.2.0 101 11/6/2026
0.1.8 184 4/23/2026
0.1.7 135 4/22/2026
0.1.6 116 4/21/2026
0.1.5 124 4/21/2026
0.1.4 128 4/18/2026
0.1.3 131 4/18/2026

Adds protocol-aware ASP.NET Core TOON formatting.
- Adds X-Toon-Version body metadata and independent response-version selection
- Adds pre-body validation with precise malformed, unsupported, and conflicting-version responses
- Breaking: defaults responses to official 4.4 with lossless omission settings and two-space indentation
- Fixes excessive response indentation by accepting HTTP override widths from 1 through 16
- Improves request option reuse while revalidating changed override headers
- Updates the runtime dependency to DevOp.Toon 0.3.0