Demystifying Data in n8n: JSON, Lists, and Items Explained

Have you ever built an automation only to find that the data is missing, corrupted, or incorrectly formatted? To build robust workflows in n8n, you must understand the “language” of data. In a fundamental lesson from the GenAI Unplugged tutorial series, we dive into how n8n structures and moves data using JSON and lists.


What is JSON? (The Universal Language)

JSON stands for JavaScript Object Notation. It is the standard format used by modern applications (like Amazon, Slack, or Google Sheets) to share data [00:55].

Think of JSON as a Bento Box. Unlike a rigid spreadsheet (where every compartment must be the same size), a Bento Box is flexible. You can have a small compartment for a tangy snack and a large one for a main meal. Similarly, JSON allows you to store different properties for different items—like a “Screen Size” for a smartphone and “Fabric Type” for a t-shirt—all within the same structure [05:06].

Anatomy of a JSON Object:

  • Key: The label (e.g., customerName) [09:00].
  • Value: The actual data (e.g., John Doe) [09:08].
  • Nesting: You can put objects inside objects (e.g., an order object containing a product object) [03:04].

Working with Lists and Arrays

Sometimes, a single order contains multiple products. In JSON, we handle this using a List (also called an Array).

  • Notation: A list is always wrapped in square brackets [ ] [06:42].
  • Indexes: Computers start counting at 0. So, the first item in a list is at position 0, the second is at 1, and so on [09:41].

How to Access Data: The Dot Notation

To pull specific information out of a JSON structure in n8n, you use Dot Notation. This is like following a path to a specific room in a house [09:14].

  • Example 1: To get the order number of the first order in a list: orders[0].order_number [10:16].
  • Example 2: To find the price of a product nested inside an order: order_data.order.product.price [11:13].

The n8n “Items” Philosophy

One of the most unique things about n8n is how it handles these lists. In n8n, lists are treated as Items.

When a list of 10 orders enters a node, that node doesn’t just look at the list as one big block. Instead, the node runs 10 separate times—once for each individual item [14:17]. This ensures that your automation logic (like sending an email or updating a database) is applied correctly to every single piece of data flowing through the system [15:37].

Why This Matters

Understanding JSON isn’t just for developers. It is the foundational skill that allows you to:

  1. Troubleshoot why a workflow failed.
  2. Transform data from one app to fit another.
  3. Optimize how your AI agents process information.

Ready to see this in action? Watch the full tutorial here: Understanding Data in n8n

Leave a Comment

Your email address will not be published. Required fields are marked *