Work with data

Expressions

Use {{ }} to read data from earlier nodes, compute values and format text.

Any string parameter can contain {{ ... }}. If the whole value is a single {{ }} block, the raw value (number, object, boolean…) is used. Otherwise the parts are joined as a string.

Hello {{ $json.name }}               → "Hello Ada"
{{ $json.price * $json.qty }}        → 42 (number)
{{ $json.tags.join(", ") }}
{{ $("Edit Fields").json.total }}
{{ $json.user?.email ?? "unknown" }}
{{ $json.items.filter(i => i.qty > 0).map(i => i.sku) }}

Variables

NameValue
$jsonCurrent item's JSON
$itemIndexIndex of the current item
$input.item, $input.all(), $input.first(), $input.last()Items on input 1
$("Node name"), $node["Node name"]An upstream node's output: .json (the matching item), .first(), .last(), .all(), .itemMatching(i)
$execution.id, $execution.modeCurrent execution
$workflow.id, $workflow.nameCurrent workflow
$now, $today, $timestampISO date-time, ISO date, epoch milliseconds

Item matching

$("Node").json returns the item from that node that the current item derives from, not the item at the same position. The engine records each item's lineage as it flows through the workflow. Routing nodes (IF, Filter, Sort, Limit, Merge in append mode) keep it, nodes that transform items 1:1 keep it by position, and nodes such as Split Out and Merge (by position or by key) declare it explicitly.

For example, if two orders go through IF and only the second takes the false branch, $("Edit Fields").json on that branch still refers to the second order. Use $("Node").first(), .last() or .all() when you want specific items regardless of lineage.

Syntax

  • Literals: numbers, strings, booleans, null, undefined, arrays, objects.
  • Operators: + - * / %, comparisons, == != === !==, && || ??, !, unary -, and the ternary a ? b : c.
  • Access: member access (a.b, a["b"], a?.b, a?.[k]) and arrow functions (x => ..., (a, b) => ...).
  • String methods: toUpperCase toLowerCase trim trimStart trimEnd includes startsWith endsWith indexOf lastIndexOf slice substring split replace replaceAll padStart padEnd repeat charAt at concat toString.
  • Array methods: length includes indexOf join slice concat at reverse map filter find findIndex some every reduce sort flat (reverse and sort return copies).
  • Number methods: toFixed toString toPrecision.
  • Globals: Math.* (round, floor, ceil, abs, trunc, sign, sqrt, pow, min, max, random, PI), JSON.stringify/parse, Object.keys/values/entries/assign, Array.isArray, String() Number() Boolean() parseInt() parseFloat() isNaN() encodeURIComponent() decodeURIComponent().

Tips

  • Expression fields show a live preview based on the input from the last run.
  • Drag a field from the input panel onto a setting to insert {{ $json.field }}.
  • Use ?. and ?? for fields that may be missing: {{ $json.customer?.phone ?? "no phone" }}.
  • Read variables with {{ $vars.NAME }}.

Safety

Expressions are parsed and interpreted by Triggerflow. They are never passed to eval. Access to __proto__, prototype and constructor is rejected, only own properties of data objects are visible, and evaluation is capped at 200,000 steps with strings capped at 1 MB. Errors include the failing expression and appear in the node's error details.

Previous: Items and data structure · Next: Transform data