Build Array From Nested Objects

Describe the issue/error/question

Hello again n8n community!

I find myself once again trying to do something which I have no doubt is quite simple, but can somehow not quite wrap my head around the solution. After many hours, I’m coming to you all for help :slight_smile:

I have a HTTP Request Node running an API call and returning some data (see the example output below. I would like to manipulate the “topics” key so that it is just an array of Topic ID’s. These are currently nested objects (topics.topic.id). The rest of the information within the “topics” array can be discarded, The API could return multiple items (as in the example below) and I would like the data to be transformed for each item returned.

Share the output returned by the last node

{
  "id": 17892477,
  "resource_uri": "https://www.factal.com/api/v2/item/17892477/",
  "permalink": "https://www.factal.com/item/2022/10/24/un-says-three-people-reported-killed-in-clashes-in/?redirect=true",
  "slug": "un-says-three-people-reported-killed-in-clashes-in",
  "topics": [
    {
      "item": 17892477,
      "topic": {
        "id": 2110270,
        "resource_uri": "https://www.factal.com/api/v2/topic/2110270/",
        "local_url": "/topic/incident-16515742/",
        "permalink": "https://www.factal.com/topic/incident-16515742/?redirect=true",
        "items_resource_uri": "/api/v2/item/?topics=2110270",
        "related_topics_uri": "/api/v2/topic/?related_to=2110270",
        "slug": "incident-16515742",
        "parents": [],
        "active": true,
        "visible": true,
        "moderation_status": "approved",
        "name": "Tribal clashes in Sudan's Blue Nile region",
        "symbol": null,
        "created_on": "2022-07-16T14:10:36.983856Z",
        "kind": "arc",
        "category": "Incident",
        "googleid": null,
        "latitude": null,
        "longitude": null,
        "point": null,
        "bounding_box": null,
        "description": "On Oct. 19, 2022, clashes erupted again in Sudan's Blue Nile state, specifically near Ad-Damazin in a locality called Wad al Mahi. More than 170 people have been killed so far in this renewal of clashes, leaving around 90 people injured as well. Search continues for people trapped in burnt homes across the area. Curfew's have also been imposed in this locality. This comes months after at least 242 people have been killed and more than 140 injured in tribal clashes which began July 14, 2022, in Sudan's Blue Nile region.",
        "wikipedia_url": "",
        "wikipedia_content_date": null,
        "latest_item_date": "2022-10-24T15:45:31.286265Z",
        "item_count": 46,
        "published_count": 46,
        "recent_count": 0,
        "daily_count": 0,
        "trend_rank_last": 0,
        "trend_rank_current": 0,
        "asset_count": 0,
        "subscription_count": 5
      },
      "assets": [],
      "relevance": null,
      "impact_zone": null,
      "impact_zone_metadata": null
    },
    {
      "item": 17892477,
      "topic": {
        "id": 693184,
        "resource_uri": "https://www.factal.com/api/v2/topic/693184/",
        "local_url": "/topic/khartoum-sudan-state/",
        "permalink": "https://www.factal.com/topic/khartoum-sudan-state/?redirect=true",
        "items_resource_uri": "/api/v2/item/?topics=693184",
        "related_topics_uri": "/api/v2/topic/?related_to=693184",
        "slug": "khartoum-sudan-state",
        "parents": [
          1443,
          1489717,
          247481,
          1489712,
          851841
        ],
        "active": true,
        "visible": true,
        "moderation_status": "approved",
        "name": "Khartoum, Sudan",
        "symbol": null,
        "created_on": "2019-11-13T02:42:22.350716Z",
        "kind": "location",
        "category": "State",
        "googleid": "ChIJjbt_4AvYjhYReGSe1WnE5OA",
        "latitude": 15.7937709,
        "longitude": 32.8986812,
        "point": "SRID=4326;POINT (32.8986812 15.7937709)",
        "bounding_box": "SRID=4326;POLYGON ((31.613674 15.18835299999999, 31.613674 16.65636209999999, 34.3865999 16.65636209999999, 34.3865999 15.18835299999999, 31.613674 15.18835299999999))",
        "description": "",
        "wikipedia_url": "https://en.wikipedia.org/wiki/Khartoum_(state)",
        "wikipedia_content_date": "2022-10-05T07:31:05.035526Z",
        "latest_item_date": "2022-10-24T15:45:31.286265Z",
        "item_count": 665,
        "published_count": 665,
        "recent_count": 0,
        "daily_count": 0,
        "trend_rank_last": 0,
        "trend_rank_current": 0,
        "asset_count": 6,
        "subscription_count": 2
      },
      "assets": [],
      "relevance": "contextual",
      "impact_zone": null,
      "impact_zone_metadata": null
    },
    {
      "item": 17892477,
      "topic": {
        "id": 336537,
        "resource_uri": "https://www.factal.com/api/v2/topic/336537/",
        "local_url": "/topic/khartoum-sudan/",
        "permalink": "https://www.factal.com/topic/khartoum-sudan/?redirect=true",
        "items_resource_uri": "/api/v2/item/?topics=336537",
        "related_topics_uri": "/api/v2/topic/?related_to=336537",
        "slug": "khartoum-sudan",
        "parents": [
          693184,
          1443,
          1489717,
          247481,
          1489712,
          851841
        ],
        "active": true,
        "visible": true,
        "moderation_status": "approved",
        "name": "Khartoum, Sudan",
        "symbol": null,
        "created_on": "2019-01-04T07:36:56.709450Z",
        "kind": "location",
        "category": "Town",
        "googleid": "ChIJv8o3mN6PjhYRQNtnft5VHxk",
        "latitude": 15.5006544,
        "longitude": 32.5598994,
        "point": "SRID=4326;POINT (32.5598994 15.5006544)",
        "bounding_box": "SRID=4326;POLYGON ((32.4592475 15.3870932, 32.4592475 15.615997, 32.6859455 15.615997, 32.6859455 15.3870932, 32.4592475 15.3870932))",
        "description": "<p><b>Khartoum</b> or <b>Khartum</b> ( <i title=\"English pronunciation respelling\">kar-<span>TOOM</span></i>; Arabic: <span lang=\"ar\" dir=\"rtl\">الخرطوم</span>, <small>romanized: </small><span title=\"Arabic-language romanization\"><i lang=\"ar-Latn\">Al-Khurṭūm</i></span>) is the capital of Sudan. With a population of 5,274,321, its metropolitan area is the largest in Sudan. It is located at the confluence of the White Nile, flowing north from Lake Victoria, and the Blue Nile, flowing west from Lake Tana in Ethiopia. The place where the two Niles meet is known as <i>al-Mogran</i> or <i>al-Muqran</i> (<span title=\"Arabic-language text\"><span lang=\"ar\" dir=\"rtl\">المقرن</span></span>; English: \"The Confluence\"). From there, the Nile continues north towards Egypt and the Mediterranean Sea.</p><p>Divided by these two parts of the Nile, Khartoum is a tripartite metropolis with an estimated population of over five million people, consisting of Khartoum proper, and linked by bridges to Khartoum North (<span title=\"Arabic-language text\"><span lang=\"ar\" dir=\"rtl\">الخرطوم بحري</span></span> <span title=\"American Library Association – Library of Congress transliteration\"><i lang=\"ar-Latn\">al-Kharṭūm Baḥrī</i></span>) and Omdurman (<span title=\"Arabic-language text\"><span lang=\"ar\" dir=\"rtl\">أم درمان</span></span> <span title=\"American Library Association – Library of Congress transliteration\"><i lang=\"ar-Latn\">Umm Durmān</i></span>) to the west.</p><p>Khartoum was founded in 1821 as part of Ottoman Egypt, north of the ancient city of Soba. While the United Kingdom exerted power over Egypt, it left administration of the Sudan to it until Mahdist forces took over Khartoum. The British attempted to evacuate Anglo-Egyptian garrisons from Sudan but the Siege of Khartoum in 1884 resulted in the capture of the city by Mahdist forces and a massacre of the defending Anglo-Egyptian garrison. In 1898 it was reoccupied by British forces, and was the seat of the Anglo-Egyptian Sudan government until 1956.</p><p>That year the city was designated as the capital of an independent Sudan. In modern times, it has been a site of political unrest, as when three hostages were killed during the Attack on the Saudi Embassy in Khartoum in 1973. In the 21st century, the Justice and Equality Movement engaged in combat there in 2008 with Sudanese government forces as part of the War in Darfur. The Khartoum massacre occurred in 2019 during the Sudanese Revolution.</p><p>Khartoum is an economic and trade centre in Northern Africa, with rail lines from Port Sudan and El-Obeid. It is served by Khartoum International Airport, and Khartoum New International Airport is under construction. Several national and cultural institutions are in Khartoum and its metropolitan area, including the National Museum of Sudan, the Khalifa House Museum, the University of Khartoum, and the Sudan University of Science and Technology.</p>",
        "wikipedia_url": "https://en.wikipedia.org/wiki/Khartoum",
        "wikipedia_content_date": "2022-10-05T07:31:05.063344Z",
        "latest_item_date": "2022-10-24T15:45:31.286265Z",
        "item_count": 935,
        "published_count": 935,
        "recent_count": 0,
        "daily_count": 2,
        "trend_rank_last": 0,
        "trend_rank_current": 0,
        "asset_count": 5,
        "subscription_count": 6
      },
      "assets": [],
      "relevance": "contextual",
      "impact_zone": null,
      "impact_zone_metadata": null
    },
    {
      "item": 17892477,
      "topic": {
        "id": 1443,
        "resource_uri": "https://www.factal.com/api/v2/topic/1443/",
        "local_url": "/topic/sudan/",
        "permalink": "https://www.factal.com/topic/sudan/?redirect=true",
        "items_resource_uri": "/api/v2/item/?topics=1443",
        "related_topics_uri": "/api/v2/topic/?related_to=1443",
        "slug": "sudan",
        "parents": [
          1489717,
          247481,
          1489712,
          851841
        ],
        "active": true,
        "visible": true,
        "moderation_status": "approved",
        "name": "Sudan",
        "symbol": null,
        "created_on": "2017-08-23T04:38:32.786955Z",
        "kind": "location",
        "category": "Country",
        "googleid": "ChIJlbFyEMQc2RURNythKkZwv9I",
        "latitude": 12.862807,
        "longitude": 30.217636,
        "point": "SRID=4326;POINT (30.217636 12.862807)",
        "bounding_box": "SRID=4326;POLYGON ((21.8146345 9.3472209, 21.8146345 22.224918, 38.69379989999999 22.224918, 38.69379989999999 9.3472209, 21.8146345 9.3472209))",
        "description": "<link rel=\"mw-deduplicated-inline-style\" href=\"mw-data:TemplateStyles:r1033289096\">\n\n<p><b>Sudan</b> (<span><small>English: </small></span> or ; Arabic: <span lang=\"ar\" dir=\"rtl\">السودان</span>, <small>romanized: </small><span title=\"Arabic-language romanization\"><i lang=\"ar-Latn\">as-Sūdān</i></span>), officially the <b>Republic of the Sudan</b> (Arabic: <span lang=\"ar\" dir=\"rtl\">جمهورية السودان</span>, <small>romanized: </small><span title=\"Arabic-language romanization\"><i lang=\"ar-Latn\">Jumhūriyyat as-Sūdān</i></span>), is a country in Northeast Africa. It shares borders with the Central African Republic to the southwest, Chad to the west, Egypt to the north, Eritrea to the northeast, Ethiopia to the southeast, Libya to the northwest, South Sudan to the south and the Red Sea. It has a population of 45.70 million people as of 2022 and occupies 1,886,068 square kilometres (728,215 square miles), making it Africa's third-largest country by area, and the third-largest by area in the Arab League. It was the largest country by area in Africa and the Arab League until the secession of South Sudan in 2011, since which both titles have been held by Algeria. Its capital is Khartoum and its most populated city is Omdurman (part of the metropolitan area of Khartoum).</p><p>Sudan's history goes back to the Pharaonic period, witnessing the Kingdom of Kerma (<abbr title=\"circa\">c.</abbr> 2500–1500 BC), the subsequent rule of the Egyptian New Kingdom (<abbr title=\"circa\">c.</abbr> 1500 BC–1070 BC) and the rise of the Kingdom of Kush (<abbr title=\"circa\">c.</abbr> 785 BC–350 AD), which would in turn control Egypt itself for nearly a century. After the fall of Kush, the Nubians formed the three Christian kingdoms of Nobatia, Makuria, and Alodia, with the latter two lasting until around 1500. Between the 14th and 15th centuries, most of Sudan was gradually settled by Arab nomads. From the 16th to the 19th centuries, central and eastern Sudan were dominated by the Funj sultanate, while Darfur ruled the west and the Ottomans the east.</p><p>During the Mamluk and Ottoman periods, slave trade played a big role and was demanded from the Sudanese Kashif as the regular remittance of tribute. In 1811, Mamluks established a state at Dunqulah as a base for their slave trading. Under Turco-Egyptian rule of Sudan after the 1820s, the practice of trading slaves was entrenched along a north–south axis, with slave raids taking place in southern parts of the country and slaves being transported to Egypt and the Ottoman empire.</p><p>From the early 19th century, the entirety of Sudan was conquered by Egypt under the Muhammad Ali dynasty. It was under Egyptian rule that Sudan acquired its modern borders and began the process of political, agricultural, and economic development. In 1881, nationalist sentiment in Egypt led to the Orabi Revolt, \"weakening\" the power of the Egyptian monarchy, and eventually leading to the occupation of Egypt by the United Kingdom. At the same time, religious-nationalist fervour in Sudan erupted in the Mahdist Uprising led by the self-proclaimed Mahdi Muhammad Ahmad, and resulting in the establishment of the Caliphate of Omdurman. The Mahdist forces were eventually defeated by a joint Egyptian-British military force, restoring the authority of the Egyptian monarch. However, Egyptian sovereignty in Sudan would henceforth be rather nominal, as the true power in both Egypt and Sudan was now the United Kingdom. In 1899, under British pressure, Egypt agreed to share sovereignty over Sudan with the United Kingdom as a condominium. In effect, Sudan was governed as a British possession. The 20th century saw the growth of both Egyptian and Sudanese nationalism focusing on ending the United Kingdom's occupation. The Egyptian revolution of 1952 toppled the monarchy and demanded the withdrawal of British forces from all of Egypt and Sudan. Muhammad Naguib, one of the two co-leaders of the revolution, and Egypt's first President, who was half-Sudanese and had been raised in Sudan, made securing Sudanese independence a priority of the revolutionary government. The following year, under Egyptian and Sudanese pressure, the United Kingdom agreed to Egypt's demand for both governments to terminate their shared sovereignty over Sudan and to grant Sudan independence. On 1 January 1956, Sudan was duly declared an independent state.</p><p>After Sudan became independent, the Jaafar Nimeiry regime began Islamist rule. This exacerbated the rift between the Islamic North, the seat of the government, and the Animists and Christians in the South. Differences in language, religion, and political power erupted in a civil war between government forces, influenced by the National Islamic Front (NIF), and the southern rebels, whose most influential faction was the Sudan People's Liberation Army (SPLA), which eventually led to the independence of South Sudan in 2011. Between 1989 and 2019, Sudan experienced a 30-year-long military dictatorship led by Omar al-Bashir, who was accused of human rights abuses, including torture, persecution of minorities, allegations of sponsoring global terrorism, and ethnic genocide due to its actions in the War in the Darfur region that broke out in 2003. Overall, the regime's actions killed an estimated 300,000 to 400,000 people. Protests erupted in 2018, demanding Bashir's resignation, which resulted in a coup d'état on 11 April 2019 and Bashir's imprisonment.</p><p>Islam was Sudan's state religion and Islamic laws were applied from 1983 until 2020 when the country became a secular state. The economy has been described as lower-middle income, with over 35% population living in poverty, largely relies on agriculture due to long-term international sanctions and isolation, as well as a long history of internal instability and factional violence, to some extent on oil production in the oil fields of South Sudan. Sudan is a member of the United Nations, the Arab League, African Union, COMESA, Non-Aligned Movement and the Organisation of Islamic Cooperation.</p>",
        "wikipedia_url": "https://en.wikipedia.org/wiki/Sudan",
        "wikipedia_content_date": "2022-10-05T10:31:51.876487Z",
        "latest_item_date": "2022-10-24T15:46:11.534460Z",
        "item_count": 2608,
        "published_count": 2608,
        "recent_count": 0,
        "daily_count": 2,
        "trend_rank_last": 0,
        "trend_rank_current": 0,
        "asset_count": 0,
        "subscription_count": 57
      },
      "assets": [],
      "relevance": "general",
      "impact_zone": null,
      "impact_zone_metadata": null
    },
    {
      "item": 17892477,
      "topic": {
        "id": 1044549,
        "resource_uri": "https://www.factal.com/api/v2/topic/1044549/",
        "local_url": "/topic/ad-damazin-sudan/",
        "permalink": "https://www.factal.com/topic/ad-damazin-sudan/?redirect=true",
        "items_resource_uri": "/api/v2/item/?topics=1044549",
        "related_topics_uri": "/api/v2/topic/?related_to=1044549",
        "slug": "ad-damazin-sudan",
        "parents": [
          406307,
          1443,
          1489717,
          247481,
          1489712,
          851841
        ],
        "active": true,
        "visible": true,
        "moderation_status": "needs_review",
        "name": "Ad-Damazīn, Sudan",
        "symbol": null,
        "created_on": "2020-06-30T14:00:24.561701Z",
        "kind": "location",
        "category": "Town",
        "googleid": "ChIJZZ3ZUcbR9xYRR0KfLcb3SPc",
        "latitude": 11.785454,
        "longitude": 34.3421397,
        "point": "SRID=4326;POINT (34.3421397 11.785454)",
        "bounding_box": "SRID=4326;POLYGON ((34.3280698 11.7580501, 34.3280698 11.8325744, 34.381113 11.8325744, 34.381113 11.7580501, 34.3280698 11.7580501))",
        "description": "",
        "wikipedia_url": "",
        "wikipedia_content_date": null,
        "latest_item_date": "2022-10-24T15:45:31.286265Z",
        "item_count": 18,
        "published_count": 18,
        "recent_count": 0,
        "daily_count": 0,
        "trend_rank_last": 0,
        "trend_rank_current": 0,
        "asset_count": 6,
        "subscription_count": 0
      },
      "assets": [],
      "relevance": "general",
      "impact_zone": null,
      "impact_zone_metadata": null
    },
    {
      "item": 17892477,
      "topic": {
        "id": 406307,
        "resource_uri": "https://www.factal.com/api/v2/topic/406307/",
        "local_url": "/topic/blue-nile-sudan/",
        "permalink": "https://www.factal.com/topic/blue-nile-sudan/?redirect=true",
        "items_resource_uri": "/api/v2/item/?topics=406307",
        "related_topics_uri": "/api/v2/topic/?related_to=406307",
        "slug": "blue-nile-sudan",
        "parents": [
          1443,
          1489717,
          247481,
          1489712,
          851841
        ],
        "active": true,
        "visible": true,
        "moderation_status": "approved",
        "name": "Blue Nile, Sudan",
        "symbol": null,
        "created_on": "2019-04-17T15:50:34.353682Z",
        "kind": "location",
        "category": "State",
        "googleid": "ChIJry4qRM0y9hYRUejUU3FDX98",
        "latitude": 11.5860078,
        "longitude": 34.1531947,
        "point": "SRID=4326;POINT (34.1531947 11.5860078)",
        "bounding_box": "SRID=4326;POLYGON ((33.1359769 9.500347999999999, 33.1359769 12.56568, 35.09243 12.56568, 35.09243 9.500347999999999, 33.1359769 9.500347999999999))",
        "description": "<p><b>Blue Nile</b> (Arabic: <span lang=\"ar\" dir=\"rtl\">النيل الأزرق</span> <i><span title=\"DIN 31635 Arabic (Arabic language) transliteration\"><i lang=\"ar-Latn\">an-Nīl al-ʾAzraq</i></span></i>) is one of the eighteen states of the Republic of the Sudan. It was established by presidential decree nº 3 in 1992 and is named after the Blue Nile River.</p><p>The region is host to around forty different ethnic groups. Its economic activity is based on agriculture and livestock and increasing mineral exploitation.</p><p>In 2011, residents of Blue Nile were scheduled to hold ill-defined \"popular consultations\" to determine the constitutional future of the state, per the Comprehensive Peace Agreement. Instead, a dispute over the rightful government of the state, and the determination of Omar al-Bashir to eradicate the Sudan People's Liberation Movement-North, have led to a renewed insurgency and a refugee crisis. It appears that the consultations have been postponed indefinitely.</p>",
        "wikipedia_url": "https://en.wikipedia.org/wiki/Blue_Nile_(state)",
        "wikipedia_content_date": "2022-10-02T10:30:48.537997Z",
        "latest_item_date": "2022-10-24T15:45:31.286265Z",
        "item_count": 62,
        "published_count": 62,
        "recent_count": 0,
        "daily_count": 0,
        "trend_rank_last": 0,
        "trend_rank_current": 0,
        "asset_count": 0,
        "subscription_count": 0
      },
      "assets": [],
      "relevance": "general",
      "impact_zone": null,
      "impact_zone_metadata": null
    },
    {
      "item": 17892477,
      "topic": {
        "id": 851841,
        "resource_uri": "https://www.factal.com/api/v2/topic/851841/",
        "local_url": "/topic/northern-africa/",
        "permalink": "https://www.factal.com/topic/northern-africa/?redirect=true",
        "items_resource_uri": "/api/v2/item/?topics=851841",
        "related_topics_uri": "/api/v2/topic/?related_to=851841",
        "slug": "northern-africa",
        "parents": [],
        "active": true,
        "visible": true,
        "moderation_status": "approved",
        "name": "Northern Africa",
        "symbol": null,
        "created_on": "2020-02-18T21:25:03.586177Z",
        "kind": "region",
        "category": "Region",
        "googleid": null,
        "latitude": null,
        "longitude": null,
        "point": null,
        "bounding_box": null,
        "description": "Countries in this region:<br /><ul class=\"columned\"><li><a href=\"https://www.factal.com/topic/algeria/\" target=\"_blank\">Algeria</a></li><li><a href=\"https://www.factal.com/topic/egypt/\" target=\"_blank\">Egypt</a></li><li><a href=\"https://www.factal.com/topic/libya/\" target=\"_blank\">Libya</a></li><li><a href=\"https://www.factal.com/topic/morocco/\" target=\"_blank\">Morocco</a></li><li><a href=\"https://www.factal.com/topic/south-sudan/\" target=\"_blank\">South Sudan</a></li><li><a href=\"https://www.factal.com/topic/sudan/\" target=\"_blank\">Sudan</a></li><li><a href=\"https://www.factal.com/topic/tunisia/\" target=\"_blank\">Tunisia</a></li><li><a href=\"https://www.factal.com/topic/western-sahara/\" target=\"_blank\">Western Sahara</a></li></ul>",
        "wikipedia_url": "",
        "wikipedia_content_date": null,
        "latest_item_date": "2022-10-24T15:46:11.534460Z",
        "item_count": 11522,
        "published_count": 11522,
        "recent_count": 0,
        "daily_count": 0,
        "trend_rank_last": 0,
        "trend_rank_current": 0,
        "asset_count": 0,
        "subscription_count": 55
      },
      "assets": [],
      "relevance": null,
      "impact_zone": null,
      "impact_zone_metadata": null
    },
    {
      "item": 17892477,
      "topic": {
        "id": 1489712,
        "resource_uri": "https://www.factal.com/api/v2/topic/1489712/",
        "local_url": "/topic/mena-region/",
        "permalink": "https://www.factal.com/topic/mena-region/?redirect=true",
        "items_resource_uri": "/api/v2/item/?topics=1489712",
        "related_topics_uri": "/api/v2/topic/?related_to=1489712",
        "slug": "mena-region",
        "parents": [],
        "active": true,
        "visible": true,
        "moderation_status": "approved",
        "name": "MENA",
        "symbol": null,
        "created_on": "2021-05-28T16:36:08.453938Z",
        "kind": "region",
        "category": "Region",
        "googleid": null,
        "latitude": null,
        "longitude": null,
        "point": null,
        "bounding_box": null,
        "description": "",
        "wikipedia_url": "",
        "wikipedia_content_date": null,
        "latest_item_date": "2022-10-24T15:48:06.989216Z",
        "item_count": 22971,
        "published_count": 22971,
        "recent_count": 0,
        "daily_count": 0,
        "trend_rank_last": 0,
        "trend_rank_current": 0,
        "asset_count": 0,
        "subscription_count": 68
      },
      "assets": [],
      "relevance": null,
      "impact_zone": null,
      "impact_zone_metadata": null
    },
    {
      "item": 17892477,
      "topic": {
        "id": 247481,
        "resource_uri": "https://www.factal.com/api/v2/topic/247481/",
        "local_url": "/topic/emea/",
        "permalink": "https://www.factal.com/topic/emea/?redirect=true",
        "items_resource_uri": "/api/v2/item/?topics=247481",
        "related_topics_uri": "/api/v2/topic/?related_to=247481",
        "slug": "emea",
        "parents": [],
        "active": true,
        "visible": true,
        "moderation_status": "approved",
        "name": "EMEA",
        "symbol": null,
        "created_on": "2018-08-31T17:12:40.464968Z",
        "kind": "region",
        "category": "Region",
        "googleid": null,
        "latitude": null,
        "longitude": null,
        "point": null,
        "bounding_box": null,
        "description": "",
        "wikipedia_url": "",
        "wikipedia_content_date": "2021-05-26T09:41:35.862595Z",
        "latest_item_date": "2022-10-24T15:49:16.046984Z",
        "item_count": 156859,
        "published_count": 156859,
        "recent_count": 10,
        "daily_count": 41,
        "trend_rank_last": 0,
        "trend_rank_current": 0,
        "asset_count": 0,
        "subscription_count": 137
      },
      "assets": [],
      "relevance": null,
      "impact_zone": null,
      "impact_zone_metadata": null
    },
    {
      "item": 17892477,
      "topic": {
        "id": 1489717,
        "resource_uri": "https://www.factal.com/api/v2/topic/1489717/",
        "local_url": "/topic/africa/",
        "permalink": "https://www.factal.com/topic/africa/?redirect=true",
        "items_resource_uri": "/api/v2/item/?topics=1489717",
        "related_topics_uri": "/api/v2/topic/?related_to=1489717",
        "slug": "africa",
        "parents": [],
        "active": true,
        "visible": true,
        "moderation_status": "approved",
        "name": "Africa",
        "symbol": null,
        "created_on": "2021-05-28T16:37:44.498420Z",
        "kind": "region",
        "category": "Region",
        "googleid": null,
        "latitude": null,
        "longitude": null,
        "point": null,
        "bounding_box": null,
        "description": "",
        "wikipedia_url": "",
        "wikipedia_content_date": null,
        "latest_item_date": "2022-10-24T15:46:31.005738Z",
        "item_count": 15687,
        "published_count": 15687,
        "recent_count": 0,
        "daily_count": 0,
        "trend_rank_last": 0,
        "trend_rank_current": 0,
        "asset_count": 0,
        "subscription_count": 61
      },
      "assets": [],
      "relevance": null,
      "impact_zone": null,
      "impact_zone_metadata": null
    },
    {
      "item": 17892477,
      "topic": {
        "id": 77673,
        "resource_uri": "https://www.factal.com/api/v2/topic/77673/",
        "local_url": "/topic/protests/",
        "permalink": "https://www.factal.com/topic/protests/?redirect=true",
        "items_resource_uri": "/api/v2/item/?topics=77673",
        "related_topics_uri": "/api/v2/topic/?related_to=77673",
        "slug": "protests",
        "parents": [],
        "active": true,
        "visible": true,
        "moderation_status": "approved",
        "name": "protests & civil unrest",
        "symbol": "📣",
        "created_on": "2017-12-25T06:27:41.740858Z",
        "kind": "tag",
        "category": "Subvertical",
        "googleid": null,
        "latitude": null,
        "longitude": null,
        "point": null,
        "bounding_box": null,
        "description": "",
        "wikipedia_url": "https://en.wikipedia.org/wiki/Protest",
        "wikipedia_content_date": "2022-10-05T18:30:58.139646Z",
        "latest_item_date": "2022-10-24T15:47:07.464966Z",
        "item_count": 35178,
        "published_count": 35178,
        "recent_count": 8,
        "daily_count": 32,
        "trend_rank_last": 0,
        "trend_rank_current": 0,
        "asset_count": 0,
        "subscription_count": 388
      },
      "assets": [],
      "relevance": null,
      "impact_zone": null,
      "impact_zone_metadata": null
    }
  ],
  "tweet": null,
  "media": null,
  "feed": null,
  "url_domain": "twitter.com",
  "url": "",
  "content": "UN says three people reported killed in clashes in Ad Damazin, in Sudan's Blue Nile state, on Sunday; situation remains tense Monday and protesters have blocked main road to Khartoum",
  "translated_content": null,
  "source": "Twitter",
  "tweet_id": 1584567611828088800,
  "type": "text",
  "original_language": null,
  "date": "2022-10-24T15:45:31.286265Z",
  "created_date": "2022-10-24T15:45:31.286274Z",
  "updated_date": "2022-10-24T15:45:39.366211Z",
  "severity": 4,
  "status": "published",
  "submitter": "editor",
  "pushed": true,
  "pushed_major": false,
  "pushed_emerging": false,
  "tweeted": false,
  "pushed_individual": false
}

Would become:

{
  "id": 17892477,
  "resource_uri": "https://www.factal.com/api/v2/item/17892477/",
  "permalink": "https://www.factal.com/item/2022/10/24/un-says-three-people-reported-killed-in-clashes-in/?redirect=true",
  "slug": "un-says-three-people-reported-killed-in-clashes-in",
  "topics": [ 2110270, ... , ... , ... ],
  "tweet": null,
"media": null,
"feed": null,
"url_domain": "twitter.com",
"url": "",
"content": "UN says three people reported killed in clashes in Ad Damazin, in Sudan's Blue Nile state, on Sunday; situation remains tense Monday and protesters have blocked main road to Khartoum",
"translated_content": null,
"source": "Twitter",
"tweet_id": 1584567611828088800,
"type": "text",
"original_language": null,
"date": "2022-10-24T15:45:31.286265Z",
"created_date": "2022-10-24T15:45:31.286274Z",
"updated_date": "2022-10-24T15:45:39.366211Z",
"severity": 4,
"status": "published",
"submitter": "editor",
"pushed": true,
"pushed_major": false,
"pushed_emerging": false,
"tweeted": false,
"pushed_individual": false
},

You can use the Javascript map method. Effectively you need to do this item.topics = item.topics.map(x => x.topic.id)

1 Like

Thank you @pemontto!
This isn’t working for me - I think because I haven’t been able to upgrade my instance of n8n yet to include the new ‘Code’ node?
Would the script be the same for the function or functionItem node?

Use this in a Function Item node

1 Like

Thank you! That’s it :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.