N8n expressions: how to reference data from any node (with examples)

Expressions are where n8n clicks for most people — or where they get stuck for a week. Here’s the mental model that makes them simple.

Every node in n8n passes along items (think: rows of JSON). Inside an expression {{ }}, you’re asking: “which node’s data, which item, which field?”

The three patterns that cover 95% of cases:

  1. Current input data: {{ $json.email }}
    $json means “the JSON of the current item coming into this node.” This is what you’ll use most.

  2. A specific earlier node: {{ $('Get Customer').first().json.email }}
    $('Node Name') grabs another node’s output. .first() takes its first item, .json the data, .email the field. (Node names are case-sensitive and must match exactly.)

  3. All items from a node: {{ $('Get Orders').all()[2].json.total }}
    .all() returns every item as an array — useful when you need item #3 or want to count things.

Two gotchas that generate half the forum questions:

  • “null” or empty results: usually the field name doesn’t match exactly. Click the earlier node’s output panel and drag the field into your expression — n8n writes the correct reference for you. Don’t hand-type field names from memory.
  • Referencing a node that output multiple items: $('Node').json is ambiguous with multiple items, which is why .first() or .all()[i] exists. If you need per-item pairing, that’s what the Merge node is for.

My suggested learning path: build a 3-node workflow (manual trigger → Set → Set), and in the second Set node, practice pulling values from the first using the drag-and-drop expression editor. Watch what n8n generates. Ten minutes of that teaches more than any docs page.