Hello. I am a newbie of n8n.
First off, thanks for the great tool, I am enjoying working with it!
Each n8n node runs its operations on each item in the array.
In normal cases, in the first data structure it attempts operates N times on {json:obj}.
The first data structure attempts to operate N times on {json:obj}.
But it operates just once on the json array object.
[Object: {“jsonData”:[…]}}]
Please, how to solve it?
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
200,
300
]
},
{
"parameters": {
"batchSize": 1,
"options": {}
},
"name": "SplitInBatches",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 1,
"position": [
650,
300
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$node[\"HTTP Request\"].json[\"country_code\"]}}",
"value2": "US"
}
]
}
},
"name": "IF",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1000,
100
]
},
{
"parameters": {
"command": "=echo '\"success {{$node[\"SplitInBatches\"].json}}\"' >> ./http_access.log"
},
"name": "Execute Command",
"type": "n8n-nodes-base.executeCommand",
"typeVersion": 1,
"position": [
1200,
100
]
},
{
"parameters": {},
"name": "NoOp",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
1300,
290
]
},
{
"parameters": {
"functionCode": "// ipData = $node[\"recivedNode\"].json[\"data\"];\nlet ipData = [\"8.8.8.4\", \"8.8.8.8\", \"8.8.8.9\", \"192.168.10.10\"];\n\njsonStr = JSON.stringify(ipData);\njsonData = JSON.parse(jsonStr);\n\nreturn [{json:{jsonData}}];\n"
},
"name": "Function",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
350,
300
]
},
{
"parameters": {
"url": "=http://api.ipstack.com/{{$node[\"SplitInBatches\"].json}}?access_key=0a81636c6f70330b8f68ccc6819daa46",
"options": {}
},
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
800,
100
]
},
{
"parameters": {
"functionCode": "return items;"
},
"name": "Transform to table",
"type": "n8n-nodes-base.function",
"position": [
500,
390
],
"typeVersion": 1
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "Function",
"type": "main",
"index": 0
}
]
]
},
"SplitInBatches": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"IF": {
"main": [
[
{
"node": "Execute Command",
"type": "main",
"index": 0
}
],
[
{
"node": "NoOp",
"type": "main",
"index": 0
}
]
]
},
"Execute Command": {
"main": [
[
{
"node": "NoOp",
"type": "main",
"index": 0
}
]
]
},
"Function": {
"main": [
[
{
"node": "SplitInBatches",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "SplitInBatches",
"type": "main",
"index": 0
},
{
"node": "IF",
"type": "main",
"index": 0
}
]
]
}
}
}