Check the example below:
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
250,
300
]
},
{
"parameters": {
"functionCode": "return [\n {\n json: {\n Name: 'test',\n Phone: 123456\n }\n },\n {\n json: {\n Name: 'test2',\n Phone: 1234562\n }\n },\n]"
},
"name": "Function",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
540,
300
]
},
{
"parameters": {
"functionCode": "const phones = []\n\n\nfor (const item of items) {\n phones.push(item.json.Phone)\n}\n\nreturn [\n {\n json: {\n phones,\n }\n }\n]\n\n\n"
},
"name": "Function1",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
770,
300
]
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "Function",
"type": "main",
"index": 0
}
]
]
},
"Function": {
"main": [
[
{
"node": "Function1",
"type": "main",
"index": 0
}
]
]
}
}
}