📄 从JSON提取键值对 - n8n工作流
初级
这是一个Engineering领域的自动化工作流,包含 5 个节点。主要使用 Set, Code, ManualTrigger 等节点。 JSON数据工具:按索引提取键值对
前置要求
- •无特殊前置要求,导入即可使用
使用的节点 (5)
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "LSZHMsAomkKlMfYR",
"meta": {
"instanceId": "14e4c77104722ab186539dfea5182e419aecc83d85963fe13f6de862c875ebfa"
},
"name": "📄 从JSON提取键值对 - n8n工作流",
"tags": [],
"nodes": [
{
"id": "9ef4197b-17d8-42aa-b771-2b151763298a",
"name": "当点击\"测试工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-40,
-20
],
"parameters": {},
"typeVersion": 1
},
{
"id": "7fa816d2-60e4-42bc-9803-3e49ceb7a4ab",
"name": "输入JSON节点",
"type": "n8n-nodes-base.set",
"position": [
140,
-20
],
"parameters": {
"mode": "raw",
"options": {},
"jsonOutput": "{\n \"myData\": {\n \"name\": \"Alice\",\n \"age\": \"30\",\n \"city\": \"Paris\"\n },\n \"rowIndex\": \"1\"\n}\n\n"
},
"typeVersion": 3.4
},
{
"id": "c2a948b4-65b5-490d-8e4c-cdb6b39ad70e",
"name": "查找键值对",
"type": "n8n-nodes-base.code",
"position": [
340,
-20
],
"parameters": {
"language": "python",
"pythonCode": "import json\nans=[]\nind = (_input.first().json.rowIndex)\nind=int(ind)\n\nfor i in _input.first().json.myData:\n if ind==0:\n ans.append(i)\n ans.append(_input.first().json.myData[i])\n break\n ind=ind-1\n\n# Return in valid n8n format\nreturn [{\"json\": {\"result\": ans}}]\n\n\n\n\n"
},
"typeVersion": 2,
"alwaysOutputData": true
},
{
"id": "c2f94136-8254-44b6-abe2-39caa814b036",
"name": "键",
"type": "n8n-nodes-base.set",
"position": [
600,
-140
],
"parameters": {
"options": {
"dotNotation": false,
"ignoreConversionErrors": true
},
"assignments": {
"assignments": [
{
"id": "243bbcc4-ff8a-4af5-b80b-96c524d33118",
"name": "result",
"type": "array",
"value": "={{ $json.result[0] }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "1e6f42da-e376-463b-acc5-37a5454d55d3",
"name": "值",
"type": "n8n-nodes-base.set",
"position": [
600,
120
],
"parameters": {
"options": {
"dotNotation": false,
"ignoreConversionErrors": true
},
"assignments": {
"assignments": [
{
"id": "5b20ed91-93b0-45b4-b555-5d7a3cff672e",
"name": "result[1]",
"type": "string",
"value": "={{ $json.result[1] }}"
}
]
}
},
"typeVersion": 3.4
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "fc8d479a-c821-44d1-9b46-f617cbfb5e25",
"connections": {
"c2f94136-8254-44b6-abe2-39caa814b036": {
"main": [
[]
]
},
"7fa816d2-60e4-42bc-9803-3e49ceb7a4ab": {
"main": [
[
{
"node": "c2a948b4-65b5-490d-8e4c-cdb6b39ad70e",
"type": "main",
"index": 0
}
]
]
},
"c2a948b4-65b5-490d-8e4c-cdb6b39ad70e": {
"main": [
[
{
"node": "c2f94136-8254-44b6-abe2-39caa814b036",
"type": "main",
"index": 0
},
{
"node": "1e6f42da-e376-463b-acc5-37a5454d55d3",
"type": "main",
"index": 0
}
]
]
},
"9ef4197b-17d8-42aa-b771-2b151763298a": {
"main": [
[
{
"node": "7fa816d2-60e4-42bc-9803-3e49ceb7a4ab",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
初级 - 工程
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
支持文本、语音、图像和PDF的AI驱动WhatsApp聊天机器人(RAG)
支持文本、语音、图像和PDF的AI驱动WhatsApp聊天机器人(RAG)
Set
Code
Switch
+
Set
Code
Switch
35 节点NovaNode
工程
API架构提取器
API架构提取器
If
Set
Code
+
If
Set
Code
88 节点Polina Medvedieva
工程
自动生成GitHub发布说明并通过Slack通知
自动生成GitHub发布说明并通过Slack通知
Set
Code
Form Trigger
+
Set
Code
Form Trigger
10 节点WeblineIndia
开发运维
n8n 工作流节点重命名器 by UpFastAI
使用 AI (Gemini/Claude) 自动重命名工作流节点以提高可读性
N8n
Set
Code
+
N8n
Set
Code
12 节点Dr. Christoph Schorsch
工程
使用 HTTP Last-Modified 检查从 Google Sheets 获取职位发布过期和刷新提醒
通过 Google Sheets、HTTP 检查和 Gmail 实现职位发布过期提醒的自动化
If
Set
Code
+
If
Set
Code
19 节点WeblineIndia
人力资源
iOS环境配置同步向导:.env到Xcode
使用GitHub PR和邮件通知自动化iOS配置同步:.env到Xcode
Set
Code
Gmail
+
Set
Code
Gmail
12 节点WeblineIndia
开发运维
工作流信息
难度等级
初级
节点数量5
分类1
节点类型3
作者
WeblineIndia
@weblineindiaA Leading Software Engineering, Consulting & Outsourcing Services Company in USA & India serving Clients Globally since 1999.
外部链接
在 n8n.io 查看 →
分享此工作流