Skip to content
Visual explainer 3h to learn 5 steps

How JSON items, mapping and expressions work in n8n

Follow items through a workflow and fix a broken field mapping using expressions and the execution data.

By Invicly Tech, , in n8n, AI Automation and Voice Agents. About 9 minutes to read.

Topic 2 of 43

In short

Data in n8n moves between nodes as a list of items. Each item is a small JSON object, and most nodes run once for every item. Expressions, written between double curly braces, let one node read values produced by an earlier node.

Think of it like this: Items are like index cards in a tray. Each node picks up the tray, works on every card, and hands on a new tray.

Explained simply

In n8n, data travels as items. An item is one record, like one appointment request. A node usually receives several items at once and handles each in turn. You can see them in the table or JSON view on the output side of any node.

Each item holds its fields inside a part called json. A request might have name, email and slot. When a later node needs the email, it asks for it with an expression. An expression is a tiny instruction written between double curly braces, such as {{ $json.email }}.

The word $json means the current item. If three items arrive, the expression is worked out three times, once for each. This is called per-item scope, and it is why one node can personalise ten messages without a loop.

Mistakes are normal. A field might be spelled differently, nested one level deeper, or empty. n8n saves what went into and out of every node in the execution. Compare the input panel with your expression and the problem usually shows itself.

Press Play on a diagram to walk through it one step at a time.

LayersWhat one item looks like
  1. 1
    Item list

    An array. The node output you see in the table or JSON view.

  2. 2
    Item

    One entry in that array. Nodes usually run once per item.

  3. 3
    json

    The main data of the item: the fields you map and test.

  4. 4
    binary (optional)

    Attached files such as images or PDFs.

  5. 5
    Fields

    Strings, numbers, booleans, nested objects and arrays inside json.

FlowFixing a mapping mistake
  1. 1
    Run the workflow

    Execute and open the failing node

  2. 2
    Read the input panel

    What actually arrived?

  3. 3
    Compare the field name

    Spelling, case and nesting

  4. 4
    Correct the expression

    Drag the field from the input panel

  5. 5
    Re-run the node

    Check the output item count and values

CompareThree ways to read data in an expression
$json.field
  • Current item, previous node
  • Most common choice
  • Short and readable
$('Node').item
  • Matching item from a named node
  • Use when data is several steps back
  • Breaks if the node is renamed
$('Node').all()
  • The full list from a node
  • Use for counts and totals
  • Returns an array, not one value

In depth

The shape of an item list

Under the table view, a node output is a list of objects. Each object has a json key that holds your fields. Some items also have a binary key for files. When you add an Edit Fields node, you can create new fields or change existing ones, and the item list goes on to the next node.

Nested data keeps its shape. If a field is an object, you reach into it with dots: {{ $json.customer.email }}. If it is an array, you use an index: {{ $json.slots[0] }}. Keeping these paths in mind makes the input panel easy to read.

  • Output is an array of items
  • Fields live under json
  • Dots reach into objects
  • Square brackets reach into arrays
MapA nested item
item.json
  • name
    • Ada Test
  • customer
    • email
    • phone
  • slots
    • [0]
    • [1]

Mapping fields between nodes

Mapping means feeding a value from one node into a parameter of the next. The simplest way is to drag a field from the input panel onto the parameter. n8n writes the expression for you and shows a live preview of the result.

Expressions are JavaScript, so you can do small changes inline: {{ $json.name.toUpperCase() }} or {{ $json.slot.slice(0, 10) }}. Keep these short. If an expression becomes long, move the logic into its own node so you can see its output.

Reaching back to earlier nodes

The current item comes from the node just before. To use data from a node further back, name it. {{ $('Webhook').item.json.email }} reads the email of the matching item in the node called Webhook. The word item follows the link between items, so the right record is found even after several steps.

If you rename a node, expressions that mention it by name need updating. n8n offers to update references, but check the result. Short, clear node names make expressions easier to read.

  • $json is the current item
  • $('Name').item follows the matching item
  • $('Name').all() returns every item from that node
  • Rename nodes carefully

Finding a mapping mistake in execution data

Run the workflow, then open the node that gave the wrong value. Look at its input first: is the field there, with the spelling and nesting you expected? If the input is wrong, the fault is in an earlier node, so walk back one node and repeat. If the input is right, the fault is in your expression.

Common causes are a different capital letter, a field nested one level deeper, a value that is a number where you wanted text, and an empty string where you assumed the field was missing.

Learn it in 5 short steps

About 35m each. Track them with a timer in your plan.

  1. 1
    Read the item list structure~35m
  2. 2
    Map fields between nodes~35m
  3. 3
    Write expressions that reference earlier nodes~35m
  4. 4
    Understand per-item scope~35m
  5. 5
    Use execution data to find a mapping mistake~35m

Key points

  • Each node receives a list of items and, by default, runs once per item.
  • Inside a node, {{ $json.email }} reads the email field of the current item.
  • To reach an earlier node, name it: {{ $('Webhook').item.json.email }}.
  • Dragging a field from the input panel into a parameter writes a correct expression for you and avoids typos.
  • Execution data shows the input and output of every node, so a wrong or empty value can be traced to the node that produced it.

Key terms

Tap a card to flip it. 0/5 known

Examples

json
[
  { "json": { "name": "Ada Test", "slot": "2026-03-02T09:00" } },
  { "json": { "name": "Bo Sample", "slot": "" } }
]

// In an Edit Fields node:
// customer = {{ $json.name }}
// first    = {{ $json.name.split(' ')[0] }}
// origin   = {{ $('Manual Trigger').item.json.name }}

Two items arriving at a node, and expressions that read them.

Fix an empty email in a confirmation message

A node should write a message to each customer but the email field comes out empty. Step 1: open the execution and select the node. Step 2: read the input panel and find that the field is called Email, with a capital E. Step 3: change the expression to match, run again, and see the right value on all three items.

text
Before: {{ $json.email }}      -> (empty)
Input item: { "Email": "ada@example.com" }
After:  {{ $json.Email }}      -> ada@example.com

Use an earlier node and a list

After an HTTP Request node the data is the service response, but you still want the customer name from the start of the flow. Read it from the trigger by name. Then use .all().length in a later node to report how many requests entered.

text
name:   {{ $('Manual Trigger').item.json.name }}
status: {{ $json.statusCode }}
count:  {{ $('Manual Trigger').all().length }}

Quick reference

  • {{ $json.field }} reads a field of the current item.
  • {{ $json.a.b }} reaches into a nested object; {{ $json.list[0] }} picks an array entry.
  • {{ $('Node name').item.json.field }} reads from an earlier node.
  • {{ $('Node name').all().length }} counts the items a node produced.
  • Drag fields from the input panel to avoid typos.
  • Field names are case sensitive.
  • Nodes run once per item unless the setting says otherwise.

Common mistakes

  • Writing {{ $json.Name }} when the field is name. Field names are case sensitive.
  • Expecting one result from a list: an expression runs once per item, not once for the whole list.
  • Looking only at a node's output and not its input when hunting a mapping bug.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1A node gets 4 items and uses {{ $json.name }}. How many times is the expression worked out?

Question 2

2Which expression reads the email from a node called Webhook, several steps back?

Question 3

3An expression returns empty. What is the best first step?

Question 4

4How do you reach the city inside { "customer": { "city": "Leeds" } }?

0/4 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Add an Edit Fields node that creates a field called greeting with the value Hello, followed by the item name.

  2. Exercise 2medium

    Build three items with a Code node or Edit Fields. Make one use the field key Email instead of email, then find out why a later expression returns empty for it.

  3. Exercise 3hard

    After an HTTP Request, produce one item per request with the original name plus the response status, without a loop.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

What is the difference between an item and a field?
An item is one whole record. Fields are the named values inside it, such as name and email.
Do I need to know JavaScript to use expressions?
Not much. Reading fields and small changes like toUpperCase() or slice() cover most cases. Move anything longer into its own node.
Why does my expression work in the preview but fail in a run?
The preview may use pinned or test data. Check the real input in the execution data.

Go deeper

ShareXLinkedInWhatsApp