Thanks @jan here is the solution:
( I needed to add the color ```
const data = items[0].json[“color”];
{
"nodes": [
{
"parameters": {
"functionCode": "return items[0].json.map(item => { \n return {\n json: item,\n }\n})"
},
"name": "Create JSON-items",
"type": "n8n-nodes-base.function",
"position": [
250,
1050
],
"typeVersion": 1
},
{
"parameters": {
"functionCode": "const data = items[0].json[\"color\"];\nconst data_arr = Object.keys(data).map(key => {\n return data[key]\n})\n\nreturn [{json:data_arr}]"
},
"name": "Create array",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
70,
1050
]
},
{
"parameters": {
"functionCode": "items[0].json = \n{\n \"color\": [\n {\n \"id\": 1,\n \"name\": \"blue\",\n },\n {\n \"id\": 2,\n \"name\": \"red\",\n }\n]\n};\nreturn items;"
},
"name": "Create Data",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
-110,
1050
]
}
],
"connections": {
"Create array": {
"main": [
[
{
"node": "Create JSON-items",
"type": "main",
"index": 0
}
]
]
},
"Create Data": {
"main": [
[
{
"node": "Create array",
"type": "main",
"index": 0
}
]
]
}
}
}