
Module 4 Lesson 1: Understanding JSON
Data basics. Learn the structure of JSON, how n8n arrays work, and how to access deep nested data inside your automation payloads.
Module 4 Lesson 1: Understanding JSON
In n8n, Everything is JSON. Even if you are reading a CSV file or an Excel sheet, n8n converts it to a JSON object. Understanding this structure is the key to mastering "Expressions."
1. The Structure of an Item
An n8n transmission consists of an Array of Objects.
[
{ "json": { "name": "Sudeep", "id": 1 } },
{ "json": { "name": "Antigravity", "id": 2 } }
]
Each object must have a json key (for text/numbers) and optionally a binary key (for files).
2. Accessing Nested Data
If you get data from Stripe, it might look like this:
orders -> items -> 0 -> price
In an n8n expression, you access it like this:
{{ $json.orders.items[0].price }}
3. "Item" vs "JSON"
$json: Refers to the data inside the currently processing item.$item: Refers to the item itself (used for advanced node-specific settings).
4. The Data Mapping Trap
Common mistake: trying to use a field that doesn't exist.
- Always double-click the field in the "Input" panel of the node to generate the expression automatically. This avoids typos like
user_IDvsuserId.
Exercise: The JSON Explorer
- Take the following JSON block:
{"customer": {"profile": {"email": "test@test.com"}}} - Write an n8n expression to extract the email.
- What is the difference between a JSON Object
{ }and a JSON Array[ ]? - If a node outputs 5 items, how many times will the NEXT node run? (Hint: See "Execution per item").
- Research: What is "Splitting an Array" in n8n?
Summary
JSON is the "Blood" of your automation. By understanding how n8n structures and accesses this data, you gain the ability to map information between any two apps, no matter how complex their APIs are.
Next Lesson: Text mastery: String Manipulation: Regex and more.