
DevOp.Toon.API adds ASP.NET Core MVC formatter support for TOON so your API can accept and return text/toon or application/toon through the normal formatter pipeline.
It is the transport-layer companion to DevOp.Toon. Use it when TOON should be a first-class request or response format in an ASP.NET Core application instead of a serializer you call manually.
HTTP responses (1,000 items, .NET 10, April 2026):
👉 Smaller payloads = faster over real networks
Version scope: Core 0.2.0, runtime 0.3.0, API 0.2.0, and Client 0.2.0.
Encoding defaults to official 4.4. Supply ToonEncodeOptions.ProtocolVersion with a concrete ToonProtocolVersion: V3_0, V4_0 through V4_4, CustomLegacy, or CustomV4_4. Decoding defaults to Auto; ambiguous version-dependent input needs an explicit ToonDecodeOptions.ProtocolVersion. Auto cannot be used for encoding or as a transport version.
Select CustomLegacy to retain the earlier custom wire profile. CustomV4_4 combines nested header groups with row/keyed spills. Custom profiles require compatible readers at both ends and default IgnoreNullOrEmpty and ExcludeEmptyArrays to true. Official profiles default both to false. Set both explicitly false when preserving null, empty-string, and empty-array distinctions matters. Explicit option overrides remain effective when changing versions. Columnar requires a custom protocol selection.
Encoder options and runtime DI encoding default to one-space indentation; decoder options default to two spaces. With explicit decode options, match the producer’s indentation or detect options using the supplied version hint. API registration aligns both widths at two spaces. Byte sequences default to Base64 strings; numeric-array output is an explicit policy choice.
Request X-Toon-Version labels the request body. Request X-Toon-Option-ProtocolVersion independently selects the response format. Response X-Toon-Version labels the actual TOON response. Concrete wire names are 3.0, 4.0 through 4.4, custom-legacy, and custom-4.4.
API 0.2.0 validates version headers and supplied X-Toon-Option-* headers before model binding/body consumption. Malformed, multiple, or conflicting body versions return 400; well-formed unsupported body versions return 415. Malformed response-version requests return 400; well-formed unsupported response versions return 406. Version validation errors use application/problem+json.
X-Toon-Option-Indent takes an integer width from 1 through 16; booleans and out-of-range widths return 400. This HTTP input limit is separate from trusted direct runtime configuration. API indentation defaults to two spaces when no override is supplied.
Client 0.2.0 changes ToonResponseEncodeOverrideOptions.Indent from bool? to int?. Use Indent = 2, or null to omit the override. EncodeOptions.ProtocolVersion controls outbound request bodies; ResponseEncodeOverrides.ProtocolVersion controls response selection. Invalid, unsupported, multiple, or conflicting response-version hints produce ToonClientException. An explicit decoder setting must agree with the response header. Without a header, configured decode options apply, defaulting to Auto.
AddToon(...)X-Toon-Option-* headersDevOp.Toon and needing MVC integrationhttps://www.nuget.org/packages/DevOp.Toon.API
Click here for donations and support

Source usage reference: DevOp.Toon.API README.