My point was that format is terrible. An object or array of objects is far more suited.
Try these 3 demos - see what suits you...
[
{
"id": "eb890c42660627b1",
"type": "inject",
"z": "eb3bd3ff.33367",
"name": "fake DB data",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "[{\"Feldkennung\":104101,\"Feldname\":\"Projektnummer\",\"WertimFeld\":\"123 dummy\"},{\"Feldkennung\":104101,\"Feldname\":\"Projektnummer\",\"WertimFeld\":\"123 dummy\",\"AnotherFeld\":\"another value\"}]",
"payloadType": "json",
"x": 920,
"y": 660,
"wires": [
[
"7eb4c0d1f00403b5",
"883b851d53d857a2",
"33aead0e2507b653"
]
]
},
{
"id": "7eb4c0d1f00403b5",
"type": "function",
"z": "eb3bd3ff.33367",
"name": "what you are after",
"func": "const werte = msg.payload.map(e => { return [...Object.values(e), ...Object.keys(e)] });\nmsg.payload = werte.flat(2);\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1150,
"y": 600,
"wires": [
[
"8e518250ae8f4e2f"
]
]
},
{
"id": "8e518250ae8f4e2f",
"type": "debug",
"z": "eb3bd3ff.33367",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1510,
"y": 600,
"wires": []
},
{
"id": "883b851d53d857a2",
"type": "function",
"z": "eb3bd3ff.33367",
"name": "a better way",
"func": "const werte = msg.payload.map(e => Object.entries(e));\nmsg.payload = werte.flat(1);\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1130,
"y": 660,
"wires": [
[
"38e4234858c1392e"
]
]
},
{
"id": "33aead0e2507b653",
"type": "function",
"z": "eb3bd3ff.33367",
"name": "much better (keeps name+value together)",
"func": "const data = msg.payload;\nconst result = [];\nlet rowNo = 0;\ndata.forEach(d => {\n rowNo++;\n let nvarr = Object.entries(d);\n nvarr.forEach(e => {\n const nvpair = {\n row: rowNo,\n field: e[0],\n value: e[1]\n }\n result.push(nvpair)\n })\n})\nmsg.payload = result;\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1220,
"y": 720,
"wires": [
[
"fd54add26e56f888"
]
]
},
{
"id": "38e4234858c1392e",
"type": "debug",
"z": "eb3bd3ff.33367",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1510,
"y": 660,
"wires": []
},
{
"id": "fd54add26e56f888",
"type": "debug",
"z": "eb3bd3ff.33367",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1510,
"y": 720,
"wires": []
}
]