Extract Array from Array

I’m trying to transform

[
  {
    "attachments": [
      {
        "type": "attachment",
        "content": {
          "type": "Buffer",
          "data": [
            137,
            80,
            78
          ]
        },
        "contentType": "image/png",
        "partId": "2.3",
        "release": null,
        "contentDisposition": "inline",
        "filename": "green.png",
        "contentId": "<EE4E2378-01BA-4F5A-A33E-E92BA651CCB1>",
        "cid": "EE4E2378-01BA-4F5A-A33E-E92BA651CCB1",
        "related": true,
        "headers": {},
        "checksum": "70ef53557f8ae9386b67e1cb73893e42",
        "size": 445
      },
      {
        "type": "attachment",
        "content": {
          "type": "Buffer",
          "data": [
            137,
            80,
            78,
            71
          ]
        },
        "contentType": "image/png",
        "partId": "4.3.2",
        "release": null,
        "contentDisposition": "inline",
        "filename": "red.png",
        "contentId": "<E946E035-9934-4B21-9D31-69DC6913A1B1>",
        "cid": "E946E035-9934-4B21-9D31-69DC6913A1B1",
        "related": true,
        "headers": {},
        "checksum": "6ce8cfa3ae58f03ea78d00ab46a3449c",
        "size": 445
      }
    ],
    "headers": {},
    "headerLines": [
        etc.
        

into

[
  {
    "type": "attachment",
    "content": {
      "type": "Buffer",
      "data": [
        137,
        80,
        78,
        71
      ]
    },
    "contentType": "image/png",
    "partId": "2.2",
    "release": null,
    "contentDisposition": "inline",
    "filename": "red.png",
    "contentId": "<E946E035-9934-4B21-9D31-69DC6913A1B1>",
    "cid": "E946E035-9934-4B21-9D31-69DC6913A1B1",
    "related": true,
    "headers": {},
    "checksum": "6ce8cfa3ae58f03ea78d00ab46a3449c",
    "size": 445
  },
  {
    "type": "attachment",
    "content": {
      "type": "Buffer",
      "data": [
        137,
        80,
        78,
        71
      ]
    },
    "contentType": "image/png",
    "partId": "4.3.3",
    "release": null,
    "contentDisposition": "inline",
    "filename": "green.png",
    "contentId": "<EE4E2378-01BA-4F5A-A33E-E92BA651CCB1>",
    "cid": "EE4E2378-01BA-4F5A-A33E-E92BA651CCB1",
    "related": true,
    "headers": {},
    "checksum": "70ef53557f8ae9386b67e1cb73893e42",
    "size": 445
  }
]

I’ve tried the Item List and Set Nodes, but I keep up ending up with the extra “attachments”: [
{ bit …

[
{
"attachments": [
{
"type": "attachment",
"content": {
"type": "Buffer",
"data": [
137,
80,

Any suggestions on how to solve this will be really appreciated!

Thanks in advance.

Hi @dickhoning - when I try to do this with Item Lists node, it works when “Include: No Other Fields”. The attachments: key is only added when “All other fields” or “Selected other fields” is selected for the “Include” parameter.

Here is an example - the function node is simply outputting your same data (except for the headers info):

1 Like

Hi @maxT thanks, and in the meantime I already found another solution. Apparently, there is more than one road to Rome :grinning:

2 Likes