The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "\u6570\u636e\u5408\u5e76\u8be6\u7ec6\u793a\u4f8b",
"nodes": [
{
"parameters": {},
"id": "trigger-1",
"name": "\u5f00\u59cb\u89e6\u53d1",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
240,
400
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "\u6570\u636e\u7c7b\u578b",
"value": "\u7528\u6237\u57fa\u7840\u4fe1\u606f"
}
],
"json": [
{
"name": "\u7528\u6237\u6570\u636e",
"value": "[\n {\"id\": 1, \"name\": \"\u5f20\u4e09\", \"department\": \"\u6280\u672f\u90e8\"},\n {\"id\": 2, \"name\": \"\u674e\u56db\", \"department\": \"\u9500\u552e\u90e8\"},\n {\"id\": 3, \"name\": \"\u738b\u4e94\", \"department\": \"\u5e02\u573a\u90e8\"}\n]"
}
]
},
"options": {}
},
"id": "user-data-source",
"name": "\u7528\u6237\u57fa\u7840\u6570\u636e",
"type": "n8n-nodes-base.set",
"typeVersion": 3,
"position": [
460,
300
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "\u6570\u636e\u7c7b\u578b",
"value": "\u85aa\u8d44\u4fe1\u606f"
}
],
"json": [
{
"name": "\u85aa\u8d44\u6570\u636e",
"value": "[\n {\"user_id\": 1, \"salary\": 15000, \"bonus\": 3000},\n {\"user_id\": 2, \"salary\": 12000, \"bonus\": 2500},\n {\"user_id\": 3, \"salary\": 13000, \"bonus\": 2800}\n]"
}
]
},
"options": {}
},
"id": "salary-data-source",
"name": "\u85aa\u8d44\u6570\u636e",
"type": "n8n-nodes-base.set",
"typeVersion": 3,
"position": [
460,
500
]
},
{
"parameters": {
"jsCode": "// \u5c55\u5f00\u7528\u6237\u57fa\u7840\u6570\u636e\nconst userData = JSON.parse($input.first().json.\u7528\u6237\u6570\u636e);\nreturn userData.map(user => ({\n json: {\n ...user,\n \u6570\u636e\u6765\u6e90: '\u7528\u6237\u57fa\u7840\u4fe1\u606f'\n }\n}));"
},
"id": "expand-user-data",
"name": "\u5c55\u5f00\u7528\u6237\u6570\u636e",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
680,
300
]
},
{
"parameters": {
"jsCode": "// \u5c55\u5f00\u85aa\u8d44\u6570\u636e\nconst salaryData = JSON.parse($input.first().json.\u85aa\u8d44\u6570\u636e);\nreturn salaryData.map(salary => ({\n json: {\n ...salary,\n \u6570\u636e\u6765\u6e90: '\u85aa\u8d44\u4fe1\u606f'\n }\n}));"
},
"id": "expand-salary-data",
"name": "\u5c55\u5f00\u85aa\u8d44\u6570\u636e",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
680,
500
]
},
{
"parameters": {
"mode": "combine",
"combineBy": "combineAll",
"options": {}
},
"id": "merge-combine-all",
"name": "\u7ec4\u5408\u6240\u6709\u6570\u636e",
"type": "n8n-nodes-base.merge",
"typeVersion": 3,
"position": [
900,
400
]
},
{
"parameters": {
"mode": "combine",
"combineBy": "combineByPosition",
"options": {}
},
"id": "merge-by-position",
"name": "\u6309\u4f4d\u7f6e\u5408\u5e76",
"type": "n8n-nodes-base.merge",
"typeVersion": 3,
"position": [
900,
600
]
},
{
"parameters": {
"jsCode": "// \u624b\u52a8\u5173\u8054\u5408\u5e76\u7528\u6237\u548c\u85aa\u8d44\u6570\u636e\nconst allItems = $input.all();\n\n// \u5206\u79bb\u7528\u6237\u6570\u636e\u548c\u85aa\u8d44\u6570\u636e\nconst userData = allItems.filter(item => item.json.\u6570\u636e\u6765\u6e90 === '\u7528\u6237\u57fa\u7840\u4fe1\u606f');\nconst salaryData = allItems.filter(item => item.json.\u6570\u636e\u6765\u6e90 === '\u85aa\u8d44\u4fe1\u606f');\n\n// \u6839\u636eID\u5173\u8054\u5408\u5e76\nconst mergedData = userData.map(userItem => {\n const user = userItem.json;\n const salary = salaryData.find(salaryItem => \n salaryItem.json.user_id === user.id\n )?.json;\n \n return {\n json: {\n // \u7528\u6237\u57fa\u7840\u4fe1\u606f\n id: user.id,\n name: user.name,\n department: user.department,\n // \u85aa\u8d44\u4fe1\u606f\n salary: salary?.salary || 0,\n bonus: salary?.bonus || 0,\n // \u8ba1\u7b97\u5b57\u6bb5\n total_compensation: (salary?.salary || 0) + (salary?.bonus || 0),\n // \u5143\u6570\u636e\n \u5408\u5e76\u65f6\u95f4: new Date().toISOString(),\n \u6570\u636e\u5b8c\u6574\u6027: salary ? '\u5b8c\u6574' : '\u7f3a\u5931\u85aa\u8d44\u6570\u636e'\n }\n };\n});\n\nreturn mergedData;"
},
"id": "manual-join",
"name": "\u624b\u52a8\u5173\u8054\u5408\u5e76",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1120,
400
]
},
{
"parameters": {
"jsCode": "// \u6309\u4f4d\u7f6e\u5408\u5e76\u7684\u6570\u636e\u5904\u7406\nconst items = $input.all();\n\n// \u5047\u8bbe\u524d\u4e00\u534a\u662f\u7528\u6237\u6570\u636e\uff0c\u540e\u4e00\u534a\u662f\u85aa\u8d44\u6570\u636e\nconst halfLength = Math.floor(items.length / 2);\nconst userData = items.slice(0, halfLength);\nconst salaryData = items.slice(halfLength);\n\n// \u6309\u4f4d\u7f6e\u914d\u5bf9\nconst pairedData = userData.map((userItem, index) => {\n const user = userItem.json;\n const salary = salaryData[index]?.json || {};\n \n return {\n json: {\n \u914d\u5bf9\u7d22\u5f15: index,\n \u7528\u6237\u4fe1\u606f: user,\n \u85aa\u8d44\u4fe1\u606f: salary,\n \u5408\u5e76\u65b9\u5f0f: '\u6309\u4f4d\u7f6e\u914d\u5bf9'\n }\n };\n});\n\nreturn pairedData;"
},
"id": "process-position-merge",
"name": "\u5904\u7406\u4f4d\u7f6e\u5408\u5e76",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1120,
600
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "\u5904\u7406\u7ed3\u679c",
"value": "=\u5173\u8054\u5408\u5e76\u5b8c\u6210\uff0c\u5171\u5904\u7406 {{ $json.length || 0 }} \u6761\u8bb0\u5f55"
},
{
"name": "\u793a\u4f8b\u6570\u636e",
"value": "=\u7528\u6237: {{ $json[0]?.name || 'N/A' }}\uff0c\u85aa\u8d44: {{ $json[0]?.total_compensation || 'N/A' }}"
}
]
},
"options": {}
},
"id": "format-join-result",
"name": "\u683c\u5f0f\u5316\u5173\u8054\u7ed3\u679c",
"type": "n8n-nodes-base.set",
"typeVersion": 3,
"position": [
1340,
400
]
}
],
"connections": {
"\u5f00\u59cb\u89e6\u53d1": {
"main": [
[
{
"node": "\u7528\u6237\u57fa\u7840\u6570\u636e",
"type": "main",
"index": 0
},
{
"node": "\u85aa\u8d44\u6570\u636e",
"type": "main",
"index": 0
}
]
]
},
"\u7528\u6237\u57fa\u7840\u6570\u636e": {
"main": [
[
{
"node": "\u5c55\u5f00\u7528\u6237\u6570\u636e",
"type": "main",
"index": 0
}
]
]
},
"\u85aa\u8d44\u6570\u636e": {
"main": [
[
{
"node": "\u5c55\u5f00\u85aa\u8d44\u6570\u636e",
"type": "main",
"index": 0
}
]
]
},
"\u5c55\u5f00\u7528\u6237\u6570\u636e": {
"main": [
[
{
"node": "\u7ec4\u5408\u6240\u6709\u6570\u636e",
"type": "main",
"index": 0
},
{
"node": "\u6309\u4f4d\u7f6e\u5408\u5e76",
"type": "main",
"index": 0
}
]
]
},
"\u5c55\u5f00\u85aa\u8d44\u6570\u636e": {
"main": [
[
{
"node": "\u7ec4\u5408\u6240\u6709\u6570\u636e",
"type": "main",
"index": 1
},
{
"node": "\u6309\u4f4d\u7f6e\u5408\u5e76",
"type": "main",
"index": 1
}
]
]
},
"\u7ec4\u5408\u6240\u6709\u6570\u636e": {
"main": [
[
{
"node": "\u624b\u52a8\u5173\u8054\u5408\u5e76",
"type": "main",
"index": 0
}
]
]
},
"\u6309\u4f4d\u7f6e\u5408\u5e76": {
"main": [
[
{
"node": "\u5904\u7406\u4f4d\u7f6e\u5408\u5e76",
"type": "main",
"index": 0
}
]
]
},
"\u624b\u52a8\u5173\u8054\u5408\u5e76": {
"main": [
[
{
"node": "\u683c\u5f0f\u5316\u5173\u8054\u7ed3\u679c",
"type": "main",
"index": 0
}
]
]
}
},
"createdAt": "2024-12-17T11:00:00.000Z",
"updatedAt": "2024-12-17T11:00:00.000Z",
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"meta": {
"description": "\u6f14\u793an8n\u4e2d\u4e0d\u540c\u6570\u636e\u5408\u5e76\u7b56\u7565\u7684\u8be6\u7ec6\u914d\u7f6e\u793a\u4f8b"
},
"versionId": "data-merge-detailed-v1"
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
数据合并详细示例. Event-driven trigger; 10 nodes.
Source: https://github.com/lengzhao/lengzhao.github.io/blob/64b5ebed8d3117e82111fb61b33e830eb9c23003/examples/n8n-data-merge-detailed.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This template lets you selectively import n8n workflows from a GitHub repository, even when your repository uses deeply nested folder structures.
Code Github. Uses manualTrigger, stickyNote, n8n, httpRequest. Event-driven trigger; 25 nodes.
Code Github. Uses manualTrigger, stickyNote, httpRequest, noOp. Event-driven trigger; 24 nodes.
Triggers manually or on schedule (03:00 daily by default) Fetches workflows tagged via n8n API Normalizes workflow names and applies tag convention Prepares JSON in the same structure as an n8n UI exp
Code Github. Uses manualTrigger, stickyNote, n8n, httpRequest. Event-driven trigger; 23 nodes.