Give output a name

I’m not sure how to name my question but right now I have an output:

{
    "quantity": 1,
    "totalprice": 20.00,
},
{
    "quantity": 2,
    "totalprice": 4.66,
}
{
    "quantity": 1,
    "totalprice": 19.00,
},
{
    "quantity": 4,
    "totalprice": 18.66,
}

But I would like to end with an output that’s like:

"order_items": [
{
    "quantity": 1,
    "totalprice": 20.00,
},
{
    "quantity": 2,
    "totalprice": 4.66,
}
{
    "quantity": 1,
    "totalprice": 19.00,
},
{
    "quantity": 4,
    "totalprice": 18.66,
}
]

How would I accomplish this ?

So just to understand you correctly. Right now you have 4 separate items and you want to have them in a single one instead and that underneath the key “order_items”?

Yes, that is correct.

That can be done like this:

{
  "nodes": [
    {
      "parameters": {
        "functionCode": "return [\n  {\n    json: {\n      order_items: items.map(item => item.json)\n    }\n  }\n]"
      },
      "name": "Function1",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "return [\n  {\n    json: {\n      number: 0,\n    }\n  },\n  {\n    json: {\n      number: 1,\n    }\n  }\n]"
      },
      "name": "MockData",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    }
  ],
  "connections": {
    "MockData": {
      "main": [
        [
          {
            "node": "Function1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Thank you, that works perfect!