๐ JSON์์ ํค๋ฐธ๋ฅๅฏนไบบไฝ ์ถ์ถ - n8n ์ํฌํ๋ก์ฐ
์ด๊ฒ์Engineering๋ถ์ผ์์๋ํ ์ํฌํ๋ก์ฐ๋ก, 5๊ฐ์ ๋ ธ๋๋ฅผ ํฌํจํฉ๋๋ค.์ฃผ๋ก Set, Code, ManualTrigger ๋ฑ์ ๋ ธ๋๋ฅผ ์ฌ์ฉํ๋ฉฐ. JSON ๋ฐ์ดํฐ ๋๊ตฌ: ์ธ๋ฑ์ค์ ๋ฐ๋ผ ํค๋ฐธ๋ฅ ์ ์ถ์ถ
- โขํน๋ณํ ์ฌ์ ์๊ตฌ์ฌํญ ์์ด ๊ฐ์ ธ์ ๋ฐ๋ก ์ฌ์ฉ ๊ฐ๋ฅํฉ๋๋ค
์ฌ์ฉ๋ ๋ ธ๋ (5)
์นดํ ๊ณ ๋ฆฌ
{
"id": "LSZHMsAomkKlMfYR",
"meta": {
"instanceId": "14e4c77104722ab186539dfea5182e419aecc83d85963fe13f6de862c875ebfa"
},
"name": "๐ Extract Key Value from JSON - n8n Workflow",
"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": "Input 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)๋ ์ฌ์ฉ์ ์ง์ ๋น์ฉ์ ์ง๋ถํด์ผ ํ ์ ์์ต๋๋ค.
๊ด๋ จ ์ํฌํ๋ก์ฐ ์ถ์ฒ
WeblineIndia
@weblineindiaA Leading Software Engineering, Consulting & Outsourcing Services Company in USA & India serving Clients Globally since 1999.
์ด ์ํฌํ๋ก์ฐ ๊ณต์