Template Expression
Template expressions let you generate text dynamically from runtime data.
Syntax Overview
Use double curly braces to evaluate an expression:
{{ expression }}Expression rules:
- Plain text outside
{{ ... }}is returned as-is. - Function calls are space-separated:
{{ functionName arg1 arg2 }}. - Use double quotes for arguments with spaces:
{{ lowercase "HELLO WORLD" }}. - Nested calls use parentheses:
{{ uppercase (lowercase "MiXeD") }}. - If an expression fails, output is rendered as:
{{ERROR: ...}}.
Data Source
Most templates read values from JSON runtime data through jsonPointer.
Example runtime JSON:
{
"project": {
"name": "Nara",
"version": 12,
"active": true,
"tags": ["vision", "flow"]
},
"node": {
"id": "node-07"
}
}Data Function: jsonPointer
jsonPointer fetches a value from JSON (e.g. node output) using a JSON Pointer path.
{{ jsonPointer pointer }}
{{ jsonPointer pointer indent }}Arguments:
pointer(required): JSON Pointer path, for example"/project/name".indent(optional): integer indentation for pretty JSON output when target is object/array.
Behavior:
- String result: returns string value.
- Number result: converted to string.
- Boolean result: returns
trueorfalse. - Null result: returns empty string.
- Object/array result:
- no indent or indent = 0: compact JSON string.
- indent > 0: pretty-printed JSON.
jsonPointer Examples
- Read a string value:
Template: {{ jsonPointer "/project/name" }}
Output: Nara- Read a numeric value:
Template: {{ jsonPointer "/project/version" }}
Output: 12- Read a boolean value:
Template: {{ jsonPointer "/project/active" }}
Output: true- Read an array (compact JSON):
Template: {{ jsonPointer "/project/tags" }}
Output: ["vision","flow"]- Read an array (pretty JSON):
Template: {{ jsonPointer "/project/tags" 2 }}
Output:
[
"vision",
"flow"
]- Chain with other functions:
Template: {{ uppercase (jsonPointer "/project/name") }}
Output: NARA- Invalid path handling:
Template: {{ jsonPointer "/project/unknown" }}
Output: {{ERROR: JSON pointer error: ...}}jsonPointer and Data References (Flow runtime)
In flow execution, string values that match the internal data-reference prefix are resolved automatically:
- Frame reference in
idFrames-> converted to Base64 string. - Vector frame reference in
idVFrames-> first frame converted to Base64. - This resolution is recursive for objects and arrays returned by
jsonPointer.
Practical effect:
- If JSON contains a data-reference token,
jsonPointercan return encoded image content instead of the raw token.
Note
The exact reference prefix is internal (FlowNodeUtils::jsonDataRefKeyPrefix()) and may differ by runtime version.
String Functions
lowercase
Converts the first argument to lowercase.
{{ lowercase "Hello WORLD" }}Output:
hello worlduppercase
Converts the first argument to uppercase.
{{ uppercase "Hello WORLD" }}Output:
HELLO WORLDcapitalize
Uppercases only the first character of the first argument.
{{ capitalize "nara flow" }}Output:
Nara flowPadding Function
stringPad
Pads a string to target length.
{{ stringPad value targetLength padToken direction }}Arguments:
value(required): source string.targetLength(required): non-negative integer.padToken(optional): token used for padding, default is single space.direction(optional):startorend, default isstart.
Examples:
{{ stringPad "7" 3 "0" "start" }}Output:
007{{ stringPad "ID" 6 "-" "end" }}Output:
ID----{{ stringPad "ABC" 8 "xy" "end" }}Output:
ABCxyxyxErrors:
- Missing required args -> error.
- Non-numeric length -> error.
- Negative length -> error.
- Invalid direction (not
startorend) -> error.
Date and Context Functions
datetimeNow
Returns current local datetime.
{{ datetimeNow }}
{{ datetimeNow "ISO_EXT_DATE_TIME_MILLISEC" }}Notes:
- If no format is provided, default format is
ISO_EXT_DATE_TIME_MILLISEC. - If format text is unknown, it falls back to the same default.
Example output:
2026-05-23T15:04:12.381toolId
Returns current flow tool ID from runtime context.
{{ toolId }}Example output:
tool-image-segmentationnodeId
Returns current flow node ID from runtime context.
{{ nodeId }}Example output:
node-07Nested Expression Examples
{{ uppercase (jsonPointer "/project/name") }}{{ stringPad (jsonPointer "/project/version") 4 "0" "start" }}{{ capitalize (lowercase "NARA TEMPLATE") }}Troubleshooting
Unknown function: ...- Function name is not registered in current runtime.
jsonPointer function requires at least one argument- Missing pointer path.
JSON pointer error: ...- Invalid path or path does not exist.
stringPad function requires a numeric length argument- Target length is not an integer.