JSON in n8n
n8n passes data from node to node as a list of items. Each item is an object with a json key, which holds the data, and a binary key when the item carries files. Most nodes run once for each item they receive, so a node that gets four items does its work four times.
[
{ "json": { "name": "Ada Lovelace", "email": "ada@example.com" } },
{ "json": { "name": "Grace Hopper", "email": "grace@example.com" } }
]Reading item data in expressions
In an expression, $json is the json object of the item being processed. So {{ $json.email }} gives the email of each item in turn, and {{ $json.address.city }} reads a nested value.
Files: the binary key
binary holds files, like an image or a PDF, each under a name such as data. Each file entry describes the file, with keys like mimeType and fileName. Nodes that read or write files, like Read/Write Files from Disk or HTTP Request, use it.
Pinned data
Pinning a node's output saves that output with the workflow. On test runs, the node returns the pinned items instead of running again, which saves calls to other services while you build. In the workflow JSON, pinned data sits under pinData, as a list of items for each node name. Production runs ignore it.
Workflow JSON
When you download a workflow or copy nodes from the canvas, n8n gives you JSON, and you can paste it back into any canvas. A workflow has a nodes list and a connections object, plus keys like name, settings and pinData. Each node has a name, a type such as n8n-nodes-base.httpRequest, a typeVersion, a position on the canvas and its parameters. connections is keyed by the name of the node each connection starts from.
{
"name": "Send welcome email",
"nodes": [
{
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [0, 0],
"parameters": { "path": "signup", "httpMethod": "POST" }
},
{
"name": "Send email",
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.1,
"position": [220, 0],
"parameters": { "sendTo": "={{ $json.body.email }}", "subject": "Welcome" }
}
],
"connections": {
"Webhook": { "main": [[{ "node": "Send email", "type": "main", "index": 0 }]] }
}
}Credentials appear in workflow JSON only as a reference, with an id and a name. The secrets stay in your n8n instance. An API key typed straight into a node's parameters, though, is part of the JSON, so check for one before you share a workflow.