Overview
This lecture explains the core data concepts used in n8n workflows, focusing on JSON structures, lists, and how data (items) is passed and processed between nodes.
Core Data Structures
- JSON is a data format with key-value pairs, written between curly braces.
- Lists are collections of objects (including JSON), written between square brackets.
- A JSON can contain another JSON as a value, called an embedded JSON.
- Dot notation (e.g.,
json.location.country) is used to access nested values in JSON structures.
Items and Tables in n8n
- Each JSON object is treated as an "item" in n8n workflows.
- A list of JSONs corresponds to multiple items, similar to rows in a table with keys as column headers.
- All node inputs and outputs in n8n must be lists of items (even if empty).
- An empty output is represented as a list containing an empty JSON.
Node Execution and Data Flow
- Nodes execute once per item in their input list, processing each item individually.
- You can set a node to execute only once for the first input item via node settings.
- Nodes can filter, modify, or transform items as they move through the workflow.
Expressions in n8n
- Expressions use double curly braces (e.g.,
{{ $json.firstName }}) to reference data from items.
- Expressions can include variables from items, JavaScript methods, or combine text and variables.
- Dragging a key from the JSON/table view into a node setting creates an expression referencing the selected data field.
- Example: Creating a "fullName" field by combining first and last name, possibly using JavaScript for formatting.
Practical Example
- The "Edit Fields" node can create new fields like "full name" by combining existing values using expressions.
- JavaScript functions can be applied within expressions, such as transforming the last name to uppercase.
Key Terms & Definitions
- JSON — A text-based data format with key-value pairs, used for structured data storage.
- List — An ordered collection of items, usually JSON objects, written within square brackets.
- Item — A single JSON object processed by n8n nodes.
- Embedded JSON — A JSON object nested within another JSON as a value.
- Expression — A dynamic formula using curly braces to reference or manipulate item data in n8n.
Action Items / Next Steps
- Review how items and lists work in your own test workflow.
- Prepare to use these data concepts to build your first workflow in the next video.