DevOp.Toon.API 0.1.8

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

DevOp.Toon.API

DevOp.Toon.API adds ASP.NET Core MVC formatter support for TOON.

Installation

dotnet add package DevOp.Toon.API

Features

  • Registers TOON MVC formatters with AddToon(...)
  • Supports text/toon and application/toon
  • Reuses DevOp.Toon for TOON encoding, decoding, and options
  • Uses Base64String byte-sequence encoding by default for byte[], List<byte>, and IEnumerable<byte>
  • Allows per-request response encode overrides through X-Toon-Option-* headers
  • Adds TOON media types to ASP.NET Core response compression options

Basic Usage

using DevOp.Toon.API;

var builder = WebApplication.CreateBuilder(args);

builder.Services
    .AddControllers()
    .AddToon();

AddToon() uses the compact columnar encoder profile by default:

  • ignores null or empty values
  • excludes empty arrays
  • uses comma delimiters
  • uses one-space indentation
  • keeps key folding off
  • writes object arrays in columnar layout

Override only the values your API needs to change:

builder.Services
    .AddControllers()
    .AddToon(options =>
    {
        options.Encode.Indent = 2;
        options.Encode.IgnoreNullOrEmpty = false;
    });

Response Compression

AddToon() adds application/toon and text/toon to ASP.NET Core response compression options. The application still controls whether response compression middleware is enabled:

builder.Services.AddResponseCompression();

var app = builder.Build();

app.UseResponseCompression();
app.MapControllers();

Per-Request Response Encode Overrides

Callers can override response encoding behavior for a single request by sending request headers in the format X-Toon-Option-<OptionName>: <value>.

Example:

GET /products
Accept: application/toon
X-Toon-Option-IgnoreNullOrEmpty: true
X-Toon-Option-ExcludeEmptyArrays: true
X-Toon-Option-ObjectArrayLayout: Columnar
X-Toon-Option-ByteArrayFormat: NumericArray
X-Toon-Option-KeyFolding: off
X-Toon-Option-Delimiter: COMMA

This overlay is applied only for the current response and does not change the application's registered ToonServiceOptions.

ByteArrayFormat is useful when a response should keep compact Base64 output by default but allow callers to opt into JSON-like numeric arrays for byte[] members:

GET /files/42
Accept: application/toon
X-Toon-Option-ByteArrayFormat: NumericArray

See Documentation/PerRequestEncodeOptions.md for details.

Package Notes

DevOp.Toon.API depends on DevOp.Toon for the runtime TOON implementation.

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.1.8 101 4/23/2026
0.1.7 106 4/22/2026
0.1.6 89 4/21/2026
0.1.5 97 4/21/2026
0.1.4 99 4/18/2026
0.1.3 97 4/18/2026

Improves DevOp.Toon 0.2.8 integration for encode option forwarding and byte sequence handling.
     - Adds ByteArrayFormat support to cloned per-request formatter encode options
     - Improves ASP.NET Core TOON responses so byte[] defaults follow the DevOp.Toon Base64String behavior
     - Fixes X-Toon-Option-ByteArrayFormat overrides so callers can request NumericArray output per response
     - Fixes typed TOON request decoding coverage for byte[] payloads encoded as Base64 strings or numeric arrays
     - Updates DevOp.Toon runtime dependency to 0.2.8