Path: redb-route/redb.Route.JsonTransform/README.md 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.JsonTransform/README.md ---- # redb.Route.JsonTransform > Documentation and articles: Declarative JSON-to-JSON transformation with [JSONata](https://jsonata.org/) — the analog of Camel's `jslt` / `jolt` / `jsonata` components — on the native .NET engine [Jsonata.Net.Native](https://github.com/mikhail-barg/jsonata.net.native) (no JavaScript, no JVM). Field-to-field mapping with renaming, nesting, array unwrapping and defaults, without writing a template for the whole document. ```csharp .TransformJson("Transforms/order-to-shipment.jsonata") // file, compiled once, cached .TransformJson(TextSource.Inline(""" { "id": orderId, "to": { "city": address.city }, "skus": items.sku, "tenant": $headers.tenant } """)) .TransformJson("Transforms/x.jsonata", JsonTransformOutput.Node) // JsonNode body instead of text ``` | Rule | Why | |---|---| | A `string` argument is a **locator** (a file path or `assembly:Name/Path/file.jsonata`); inline text is `TextSource.Inline("...")`. | A string never has to be guessed as "path or text" — the same rule as templates and the expression language. | | A relative path is looked up by the context's `IRouteResourceResolver` first, then by `JsonTransformOptions.BaseDirectory` (default `AppContext.BaseDirectory`). A miss names both places. | One lookup order for the whole framework; inside a `.tpkg` the specification lives in `resources/`, which only the package resolver knows about. | | Compiled at route build. | A missing file or a syntax error fails `Start()` with the specification name and the engine's message. | | Input: the body as JSON text, `byte[]`, `Stream`, a `System.Text.Json` tree, or a POCO (serialized camelCase). | The step sits naturally after `Unmarshal` or straight after an HTTP consumer. | | `$headers` and `$properties` are bound in the specification. | The same names the payload templates use. | | Output: JSON text with `ContentType = application/json` (default; `Indent` option), or a `JsonNode` (`JsonTransformOutput.Node`). | An undefined result leaves a `null` body. | Options: `services.AddJsonTransform(o => ...)` or `context.UseJsonTransform(o => ...)` — `BaseDirectory`, `Indent`. XML form ([redb.Route.Xml](../redb.Route.Xml/README.md)): `` or the specification as the element's text (CDATA); `output="string|node"`.