Skip to Content
This documentation is provided with the HEAT environment and is relevant for this HEAT instance only.
RunnersCore UtilsJSON Template Node

json-template (Transform Node)

The JSON Template node takes a single JSON input and an object-shaped template. Each string value in the template is treated as a JMESPath expression and evaluated against the input; the results are combined into a new JSON object. Non-string values (numbers, booleans, null, nested objects and arrays) are copied as-is.

Use this node to reshape or extract data from upstream JSON (e.g. from a previous transform or from a dashboard payload) into a structure required by a downstream node or dashboard.


Configuration Schema

PropertyTypeRequiredDescription
inputMode"all" | "latest"NoInput selection policy. all enumerates all available parent outputs (can duplicate work if parents emit cumulative snapshots). latest uses only the most recent parent output. Defaults to all.
templateobjectYesObject tree whose string leaves are JMESPath expressions. Nested objects and arrays are allowed; only string values are evaluated as expressions.
strictbooleanNoIf true, the node fails when any JMESPath expression errors. If false, failing expressions yield null and the node continues. Defaults to true.

How it works

  • Input selection (inputMode):\n - Default (all): the node enumerates all available upstream outputs and selects the first payload in that enumeration.\n - latest: the node uses only the latest upstream output.\n - When to use latest: when the parent node outputs cumulative snapshots over time (for example, repeated hydrate runs where later outputs contain all earlier events). Using latest avoids templating the same records multiple times.\n+
  • Note on multi-output parents: inputMode: "all" enumerates outputs and some runtime paths return a list of payloads for a single parent (one per upstream output). In that case, this node selects the first payload in that list.
  • The node parses the upstream payload as JSON.
  • It walks the template recursively. For every string value it finds, it compiles and runs that string as a JMESPath expression against the input JSON and replaces the string with the result.
  • For object and array values in the template, it recurses and applies the same rule to their children.
  • For numbers, booleans, and null in the template, it copies them unchanged to the output.

To output a literal string in the template, use JMESPath string literal syntax: "'Your literal string'".


Example

Input JSON:

{ "tables": { "with_timestamps": { "rows": [ { "captured_at": "2025-01-01T00:00:00Z", "speed": "10" }, { "captured_at": "2025-01-01T00:00:01Z", "speed": "12" } ] } } }

Template:

{ "template": { "chartTitle": "'Timeline'", "points": "tables.with_timestamps.rows[].{Data: speed, DateTime: captured_at}" }, "strict": true }

Output:

{ "chartTitle": "Timeline", "points": [ {"Data": "10", "DateTime": "2025-01-01T00:00:00Z"}, {"Data": "12", "DateTime": "2025-01-01T00:00:01Z"} ] }

Example configuration

{ "template": { "summary": "stats.summary", "count": "length(items)", "firstItem": "items[0]" }, "strict": true }

Integration in a session template

  1. Place a json-template node after any node that emits JSON (e.g. tabular-query, json-filter, or another transform).
  2. Define the template object so that string leaves are JMESPath expressions over that input.
  3. Set strict to true to fail on expression errors, or false to substitute null and continue.
  4. Connect downstream nodes to consume the rendered JSON.