Path: redb-route/redb.Route.DataFormats.XmlJson/XmlJsonRouteDefinitionExtensions.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route.DataFormats.XmlJson/XmlJsonRouteDefinitionExtensions.cs ---- using redb.Route.Abstractions; using redb.Route.Extensions; namespace redb.Route.DataFormats.XmlJson; /// DSL and registration sugar for . public static class XmlJsonRouteDefinitionExtensions { /// Turns an XML body into JSON, with per-node options. public static IRouteDefinition MarshalXmlJson(this IRouteDefinition route, Action? configure = null) => route.Marshal(new XmlJsonDataFormat(Build(configure))); /// /// Turns a JSON body into XML as (string, byte[], XDocument, /// XElement, XmlDocument), or an XML body into the JSON tree for T = JsonNode. /// public static IRouteDefinition UnmarshalXmlJson(this IRouteDefinition route, Action? configure = null) => route.Unmarshal(new XmlJsonDataFormat(Build(configure))); /// /// Registers the format on the context under its content type and the name xmljson, for /// <marshal format="xmljson"/> and Marshal("xmljson"). /// public static IRouteContext AddXmlJsonDataFormat(this IRouteContext context, Action? configure = null) => context.AddDataFormat(new XmlJsonDataFormat(Build(configure)), XmlJsonDataFormat.Name); /// DI form of . public static RedbRouteBuilder AddXmlJsonDataFormat(this RedbRouteBuilder builder, Action? configure = null) => builder.AddDataFormat(new XmlJsonDataFormat(Build(configure)), XmlJsonDataFormat.Name); private static XmlJsonOptions Build(Action? configure) { var options = new XmlJsonOptions(); configure?.Invoke(options); return options; } }