Overview
This lesson is part of the n8n AI Automation - Zero to Hero course, Section: 2. Getting Started.
Watch the video above for the full tutorial, or read the written guide below.
What is JSON and why does n8n use it?
JSON (JavaScript Object Notation) is the universal data exchange format that connects every app n8n integrates with. It stores data as key-value pairs, for example "order_number": "ORD001", and unlike a rigid spreadsheet table it lets each record carry a completely different set of properties. CRMs, Google Sheets, Slack, Discord, and every API n8n touches all speak JSON, making it the foundational language of automation.
JSON solves the rigidity problem that tabular data cannot. A smartphone order and a t-shirt order share header fields (order number, customer name, address) but need completely different product attributes. JSON nests objects inside objects, so product details live inside the order object, and each record describes exactly what it needs without forcing every field into the same columns. Think of it like a bento box where compartment sizes flex to fit the meal, not a fixed-grid cafeteria tray where protein and carbs must share equal space whether they fit or not.
JSON is also a plain text format, which means it compresses easily, transfers across networks cheaply, and parses reliably in every programming language. Those properties are why it became the dominant exchange format between applications and why n8n uses it internally for every node input and output.
How does a JSON list store multiple items in one structure?
A JSON list, also called an array, stores multiple items inside square brackets [ ]. Any time square brackets appear in JSON, everything inside is a collection of individual items that can each have different properties. A single order can contain a list of products: an iPhone with seven attributes and an Avengers t-shirt with five, with no requirement that both items share the same fields.
The distinction between a list and a single object matters in automation. Two separate orders with one product each are like two delivery boxes with one item apiece. One order with two products is one big box with two items inside. JSON describes both cleanly. The outer object holds the shared header data (order number, customer, address) and a key like products holds the array, with each product sitting inside its own { } block, separated by commas.
Commas separate items within the array, and the closing square bracket ends the list. Items inside the list do not need to be identical in structure. The smartphone can carry seven attributes while the t-shirt carries five, and JSON handles both without complaint.
How do you read a JSON value using dot notation?
Dot notation chains key names to walk into nested JSON objects, and square-bracket indexes pick a specific item out of a list. To reach the product name in the first order of a list variable called orders, write orders[0].order.product.name. The [0] grabs the first order (lists are zero-indexed, so position zero is first), each . steps into the next nested object, and the final key returns the value.
For a single-order variable called order_data there is no outer list, so you skip the index: order_data.order.products[0].name returns the first product name directly, and order_data.order.products[1].price returns the second product's price, which in the lesson example is $119.
The rule is: use square brackets with a number whenever you are selecting one item from a list, and use dot notation whenever you are stepping into a named object. Chaining both together lets you reach any value no matter how deeply nested. This exact syntax appears in n8n expressions whenever a node references data from a previous node, so mastering the pattern transfers directly to building workflows.
How does n8n represent and process JSON data as items?
In n8n, a list of JSON objects becomes a list of items, and every node processes each item individually. If a trigger node fetches ten customer orders, every downstream node applies its configured logic to all ten orders one at a time and passes ten output items forward. The item count stays consistent across nodes unless a node is specifically designed to merge or split data.
This per-item processing model means logic you configure once scales automatically to any volume of records. A workflow built to process one order handles a hundred orders without any changes. When debugging unexpected output, checking whether the item count entering a node matches what you expect, and whether the JSON keys you are referencing actually exist on every item, resolves the majority of data-flow mysteries.
Key Takeaways
- JSON is the lingua franca of n8n integrations. Every app n8n connects to exchanges data as JSON key-value pairs, so understanding JSON structure is non-negotiable before building reliable automations.
- Square brackets signal a list; curly braces signal an object. Whenever
[ ]appears in JSON you are dealing with multiple items that each need a zero-based index ([0],[1]) to access individually. - Dot notation plus index chaining unlocks any value. Walk nested objects with dots and pick list items with indexes:
orders[0].order.product.nameretrieves the product name from the first order in the list. - Every n8n node processes items one at a time. A node receiving ten items applies its logic ten times and outputs ten items, so one well-configured node handles any volume of records automatically.
- JSON beats tabular formats for heterogeneous data. A smartphone order and a t-shirt order coexist in the same list with completely different product attributes, something fixed spreadsheet columns cannot accommodate without creating separate tables.
Related Lessons
- Lesson 4: How to Set Up n8n Cloud in 2025 - Step by Step | n8n Cloud vs Self-Hosting
- Lesson 5: [Free n8n] How to Install n8n on local machine using NPM Node.js
- Lesson 6: How to Install n8n for free on local machine using Docker Desktop
- Lesson 7: n8n Interface Walkthrough 2025 | Complete n8n UI Guide - Admin Panel, Settings
- Lesson 8: n8n Node Types Explained (2025) | How to Build Workflow with Triggers, Apps, Core & Actions
Next Steps
Continue your n8n journey with the full n8n AI Automation - Zero to Hero course.