Looping array and making only one API call

Hello

I’m trying to do 2 different things

1 ) I need To loop over an array of things inside an array.

Here I’ve got 5 objects like this and I need to iterate over them.
And also do the same with the array inside “experiences”

Here’s the source data

[{
"body": {
     "items_count": 5,
     "results": [{
"company_employees_range": 10-50,
"current_company_name": "DPP",
"current_job_title": "CEO Northern & Western Europe",
"experiences": [
{
"company_industry": null,
"company_name": "PPS",
"location": null,
"title": "CEO Northern & Western Europe"
},
{
"company_industry": "Food & Beverages",
"company_name": "Compass Group",
"location": null,
"title": "CEO SSP"
}
],
"extracted_at": "Tue, 15 Mar 2022 14:07:21 GMT",
"first_name": "Nick",
"job_title": "CEO Northern & Western Europe",
"last_name": "Inkster",
"linkedin_profile_url": "https://www.linkedin.com/iuhigiug",
"meta": {"id_client": "12210"},
"summary": "And so after 26 very happy years at SSP plc, I retired at the end of September 2019. It has been a special experience, managing businesses all around the world, working with great teams and clients."
},
                     {...}//other objects - profiles,
                     {...},
                     {...},
                     {...},
                    ]
           },
             "headers": {},
             "statusCode": 200,
}]

Here’s the call that I would do to post

{"clients": 
[{
"company_employees_range":"null",
"company_industry":"null","current_company_name":"{{$node["HTTP Request"].json["body"]["results"][0]["current_company_name"]}}",
"current_job_title":"{{$node["HTTP Request"].json["body"]["results"][0]["current_job_title"]}}",
"extracted_at":"{{$node["HTTP Request"].json["body"]["results"][0]["extracted_at"]}}",
"first_name":"{{$node["HTTP Request"].json["body"]["results"][0]["first_name"]}}",
"last_name":"{{$node["HTTP Request"].json["body"]["results"][0]["last_name"]}}","industry":"{{$node["HTTP Request"].json["body"]["results"][0]["industry"]}}","linkedin_profile_url":"{{$node["HTTP Request"].json["body"]["results"][0]["linkedin_profile_url"]}}",
"summary":"{{$node["HTTP Request"].json["body"]["results"][0]["summary"].replace(/(\r\n|\n|\r)/gm," ")}} ",
"experiences":[{
"company_description":"null","company_industry":"null",
"company_name":"{{$node["HTTP Request"].json["body"]["results"][0]["experiences"][0]["company_name"]}}",
"company_url":"null","location":"null",
"title":"{{$node["HTTP Request"].json["body"]["results"][0]["experiences"][0]["title"]}}"
}]
}]
}

But I can only select the [0] index of my array, I can’t use the [“id”] to make it loop, it doesn’t find results whenever I try that.

2 ) I’d like also if possible to generate this object with only one POST Request and not 5 or 20 depending on the payload (I’d like everything to be merged in the same object).

How could I do ?

Hi @Hugop

Welcome to the community.
n8n loops automatically through the items it has.
I made a quick example for you to understand some basics of n8n. I could only use the one record/item you provided so I demonstrated the use of the Item Lists node with the experiences field.
You can copy-paste the JSON below and see what Is happening. If it is not clear or you are still stuck, feel free to ask.

Assigning values can easily be done with the expression editor. This can be done in any node, I have used the Set node in the example. On the left is the input that is coming from the Node before it. Make sure to run that node so there is data in it, otherwise you will not see the input data needed.

1 Like

Hello I can’t split items. The split items doesn’t seem to like what I send him.

Ok here’s a real example of the data I receive and it seems Item splits cannot read it.

[
    {
      "body": {
        "items_count": 20,
        "limit": 1000,
        "pages": 1,
        "paging": null,
        "results": [
          {
            "company_employees_range": null,
            "company_industry": null,
            "company_name": "SSP Group",
            "company_url": null,
            "connected_at": null,
            "current_company_name": "SSP Group",
            "current_company_url": null,
            "current_job_title": "CEO Northern & Western Europe",
            "description": "And so after 26 very happy years at SSP plc, I retired at the end of September 2019. It has been a special experience, managing businesses all around the world, working with great teams and clients.\nI am planning to spend a few months relaxing, but I look forward to continuing to keep an involvement with our industry, and would be happy to hear from friends and colleagues who may have an interesting project of two in the pipeline.",
            "education": [
              {
                "date": "1974 - 1978",
                "degree_name": "B.Sc. Hons, Hotel & Catering Administration",
                "id": null,
                "school_name": "University of surrey",
                "school_url": null,
                "title": "Hotel & Catering Administration"
              }
            ],
            "email": null,
            "experiences": [
              {
                "company_description": null,
                "company_employees_range": null,
                "company_id": null,
                "company_industry": null,
                "company_name": "SSP Group",
                "company_url": null,
                "date": "11/1993 - current",
                "location": null,
                "title": "CEO Northern & Western Europe"
              },
              {
                "company_description": null,
                "company_employees_range": "10001 - ",
                "company_id": "852267",
                "company_industry": "Food & Beverages",
                "company_name": "Compass Group",
                "company_url": "https://www.linkedin.com/company/compass-group/",
                "date": "1996 - 1999",
                "location": null,
                "title": "CEO SSP"
              }
            ],
            "extracted_at": "Tue, 15 Mar 2022 14:07:21 GMT",
            "first_name": "Nick",
            "following": false,
            "full_name": "Nick azdazd",
            "handle": "nick-inkster-277480a",
            "headline": " Retired former CEO Western Europe, Middle East, Asia Pacific and Nordics at SSP Group",
            "id": "ACoAAAHZWXsBjToYXpy0nO0sDtzMNlFHduxf0h8",
            "industry": "Restaurants",
            "job_title": "CEO Northern & Western Europe",
            "languages": [],
            "last_name": "azda",
            "linkedin_profile_url": "https://www.linkedin.com/in/",
            "location": "Greater Cheshire West and Chester Area",
            "meta": {
              "id_client": "12210"
            },
            "number_connections": 544,
            "number_followers": 545,
            "personal_email": null,
            "phone": null,
            "phones": null,
            "profile_country": "US",
            "profile_language": "en",
            "profile_url": "https://www.linkedin.com/in/",
            "school_name": "University of surrey",
            "school_url": null,
            "skills": [
              "Food & Beverage",
              "Business Development",
              "Customer Service",
              "Food",
              "Management",
              "Hospitality Management",
              "Restaurant Management",
              "Hospitality Industry",
              "New Business Development",
              "Business Planning",
              "Catering",
              "Operations Management",
              "Restaurants",
              "Hospitality",
              "Retail",
              "Food Service",
              "Franchising",
              "Team Leadership",
              "Team Building",
              "Hotel Management"
            ],
            "start_url": "https://www.linkedin.com/in/",
            "summary": "And so after 26 very happy years at SSP plc, I retired at the end of September 2019. It has been a special experience, managing businesses all around the world, working with great teams and clients.\nI am planning to spend a few months relaxing, but I look forward to continuing to keep an involvement with our industry, and would be happy to hear from friends and colleagues who may have an interesting project of two in the pipeline.",
            "title": "CEO Northern & Western Europe",
            "tracking_id": "B9T7ifk8T++8Wa6tfkzJOw==",
            "twitter": null,
            "twitter_handles": [],
            "volunteer_experiences": [],
            "website": null
          },
          {
            "company_employees_range": null,
            "company_industry": null,
            "company_name": "AgroConsult FM",
            "company_url": null,
            "connected_at": null,
            "current_company_name": "AgroConsult FM",
            "current_company_url": null,
            "current_job_title": "Consultant",
            "description": null,
            "education": [
              {
                "date": "1984 - 1987",
                "degree_name": "Diplôme d'ingénieur, Agronomie",
                "id": "189090",
                "school_name": "Bordeaux Sciences Agro",
                "school_url": "https://www.linkedin.com/school/bordeaux-sciences-agro/",
                "title": "Agronomie"
              }
            ],
            "email": null,
            "experiences": [
              {
                "company_description": "Conseil en développement commercial à l’international en l’irrigation, projets de \t                  développement agricole durable et sociale en Afrique de l’Est, formateur en                \t                  matières générale et technique en Centre de Formation Professionnel Agricole.",
                "company_employees_range": null,
                "company_id": null,
                "company_industry": null,
                "company_name": "AgroConsult FM",
                "company_url": null,
                "date": "9/2016 - current",
                "location": "Bouc Bel Air (13)",
                "title": "Consultant"
              },
              {
                "company_description": null,
                "company_employees_range": "51 - 200",
                "company_id": "29283341",
                "company_industry": "Management Consulting",
                "company_name": "Rubbees",
                "company_url": "https://www.linkedin.com/company/rubbees/",
                "date": "10/2019 - current",
                "location": "Conseil en management . Bordeaux . Nouvelle-Aquitaine",
                "title": "Membre"
              },
              {
                "company_description": "Marketplace dédiée aux professionnels de l’aménagement du paysage, en ligne depuis juillet 2018",
                "company_employees_range": "2 - 10",
                "company_id": "11188153",
                "company_industry": "Farming",
                "company_name": "GreenSeeker Marketplace",
                "company_url": "https://www.linkedin.com/company/greenseeker-marketplace/",
                "date": "1/2017 - current",
                "location": "Lyon (69)",
                "title": "Co-Fondateur "
              },
              {
                "company_description": "Netafim,  société globale, leader mondial de la micro-irrigation",
                "company_employees_range": "1001 - 5000",
                "company_id": "20582",
                "company_industry": "Farming",
                "company_name": "NETAFIM France",
                "company_url": "https://www.linkedin.com/company/netafim/",
                "date": "3/2013 - 2/2016",
                "location": "Gardanne",
                "title": "Directeur général"
              },
              {
                "company_description": null,
                "company_employees_range": "1001 - 5000",
                "company_id": "20582",
                "company_industry": "Farming",
                "company_name": "NETAFIM France",
                "company_url": "https://www.linkedin.com/company/netafim/",
                "date": "10/2009 - 2/2013",
                "location": "Gardanne",
                "title": "Directeur commercial"
              },
              {
                "company_description": null,
                "company_employees_range": "1001 - 5000",
                "company_id": "20582",
                "company_industry": "Farming",
                "company_name": "NETAFIM France",
                "company_url": "https://www.linkedin.com/company/netafim/",
                "date": "6/2004 - 9/2009",
                "location": "Gardanne",
                "title": "Responsable développement"
              },
              {
                "company_description": null,
                "company_employees_range": "10001 - ",
                "company_id": "3998",
                "company_industry": "Farming",
                "company_name": "SYNGENTA",
                "company_url": "https://www.linkedin.com/company/syngenta/",
                "date": "2/1996 - 6/2004",
                "location": null,
                "title": "Responsable commercial"
              },
              {
                "company_description": null,
                "company_employees_range": "5001 - 10000",
                "company_id": "125614",
                "company_industry": "Farming",
                "company_name": "fenaco",
                "company_url": "https://www.linkedin.com/company/fenaco/",
                "date": "11/1990 - 1/1996",
                "location": null,
                "title": "Responsable commercial"
              },
              {
                "company_description": null,
                "company_employees_range": null,
                "company_id": null,
                "company_industry": null,
                "company_name": "AGROSYSTEM Guadeloupe",
                "company_url": null,
                "date": "11/1987 - 6/1990",
                "location": null,
                "title": "Responsable technico-commercial"
              }
            ],
            "extracted_at": "Tue, 15 Mar 2022 14:07:39 GMT",
            "first_name": "Fabrice",
            "following": false,
            "full_name": "Fabrice Montbarbon",
            "handle": "fabricemontbarbon",
            "headline": "Consultant",
            "id": "ACoAABuoDlQBqLbohi9M0lmnijUORuRvB3MJzj0",
            "industry": "Farming",
            "job_title": "Consultant",
            "languages": [
              "anglais"
            ],
            "last_name": "Montbarbon",
            "linkedin_profile_url": "https://www.linkedin.com/in/",
            "location": "Bouc-Bel-Air, Provence-Alpes-Côte d'Azur",
            "meta": {
              "id_client": "12229"
            },
            "number_connections": 475,
            "number_followers": 476,
            "personal_email": null,
            "phone": null,
            "phones": null,
            "profile_country": "FR",
            "profile_language": "fr",
            "profile_url": "https://www.linkedin.com/in/",
            "school_name": "Bordeaux Sciences Agro",
            "school_url": "https://www.linkedin.com/school/bordeaux-sciences-agro/",
            "skills": [
              "Planification stratégique",
              "Stratégie marketing",
              "New Business Development",
              "Stratégie commerciale",
              "Management",
              "Management de la direction",
              "Service client",
              "Planification commerciale",
              "Négociations",
              "Gestion de projet",
              "Développement commercial",
              "Communication interne",
              "Agronomie",
              "Conception de produit",
              "Sales Manager",
              "Sales Management"
            ],
            "start_url": "https://www.linkedin.com/in/",
            "summary": null,
            "title": "Consultant",
            "tracking_id": "zEXz7lFIQQedLO1MwVfAPQ==",
            "twitter": null,
            "twitter_handles": [],
            "volunteer_experiences": [],
            "website": null
          },
          {
            "company_employees_range": "11 - 50",
            "company_industry": "Pharmaceuticals",
            "company_name": "IVC Pragen GmbH",
            "company_url": "https://www.linkedin.com/company/ivc-pragen-gmbh/",
            "connected_at": null,
            "current_company_name": "IVC Pragen GmbH",
            "current_company_url": "https://www.linkedin.com/company/ivc-pragen-gmbh/",
            "current_job_title": "Direktor Vertrieb & Marketing / Director Sales & Marketing",
            "description": "- Kommunikationsstarke Führungspersönlichkeit mit hoher Leistungsbereitschaft, Handlungsorientierung, Entscheidungsfreude, Eigeninitiative und Flexibilität\n- Fundierte nationale und internationale Erfahrung in den Bereichen Vertrieb, Aufbau und Ausbau von Netzwerken, Gewinnung von Neukunden, Business Development, Key-Account-Management, Projektmanagement (klassisch & agil) und Change \n- Aufbau von Unternehmensstrukturen und Prozessen - von der „grünen Wiese“ bis zur Expansion \n- Branchenerfahrungen und Netzwerk: FMCG, Handel, E-Commerce, Pharma & Health Care, Consulting, Start-Up und Sport\n- Nachweisbare Erfolge in diversen Firmenstrukturen - vom Unternehmensaufbau über Mittelstand bis hin zum Konzern\n- Magna cum Laude Abschluss an einer weltweit renommierten Ivy League Institution (Columbia University USA)",
            "education": [
              {
                "date": "2006 - 2010",
                "degree_name": "Bachelor of Arts (B.A.), Economics & Political Science (Double Major)",
                "id": "18943",
                "school_name": "Columbia University in the City of New York",
                "school_url": "https://www.linkedin.com/school/columbia-university/",
                "title": "Economics & Political Science (Double Major)"
              },
              {
                "date": "2008 - 2009",
                "degree_name": null,
                "id": "11834",
                "school_name": "Freie Universität Berlin",
                "school_url": "https://www.linkedin.com/school/freie-universitat-berlin/",
                "title": "Wirtschaftswissenschaften"
              }
            ],
            "email": null,
            "experiences": [
              {
                "company_description": "- volle Umsatz- und Budgetverantwortung inklusive Business Planung, Forecasting und Controlling\n- Generierung von starkem, profitablem Wachstum und die Erschließung neuer Absatzkanäle im deutschen Lebensmitteleinzehandel, Drogeriesegment und e-Commerce (private Label und Marke)\n- Markenentwicklung und -einführung in multiplen Absatzkanälen\n- Entwicklung, Umsetzung und Steuerung von ATL und BTL Marketingmaßnahmen sowie POS-Materialien inklusive Agentursteuerung\n- Akquisition von und Verhandlungsführung mit High Value Key Accounts wie Amazon, ALDI, EDEKA, REWE, Kaufland, DM, Rossmann, uvm.\n- Strategische Ausrichtung und Steuerung des Vertriebsaußendienst/Feldorganisation\n- Erfolgreiche, alleinverantwortliche Verhandlungsführung und Vertragsabschluss von Einzelgroßaufträgen im LEH/DM Segment (Umsatz von + 40 Mio EUR) im Healthcare Bereich (BOSON COVID-19 AntiGen Schnelltests)\n- Interim Geschäftsführung mit Restrukturierung bzw. Aufbau der Vertriebs- und Marketingorganisation",
                "company_employees_range": "11 - 50",
                "company_id": "28552726",
                "company_industry": "Pharmaceuticals",
                "company_name": "IVC Pragen GmbH",
                "company_url": "https://www.linkedin.com/company/ivc-pragen-gmbh/",
                "date": "10/2020 - 8/2021",
                "location": "Metropolregion Hannover-Braunschweig-Göttingen-Wolfsburg",
                "title": "Direktor Vertrieb & Marketing / Director Sales & Marketing"
              },
              {
                "company_description": "- Umsatzverantwortung im dreistelligen Millionenbereich inkl. P&L & Budgetverantwortung\n- Mitarbeiterführung & -entwicklung\n- (International) Business Development; vorwiegend Erschließung neuer Absatz- & Kommunikationskanäle\n- Generierung von Zusatzumsätzen & starkem, profitablen Wachstum\n- Neukundenakquise & Key Account Management inklusive Verhandlungsführung\n- strategische Beratung in den Bereichen Digitalisierung, Omnichannel-Transformation, Prozessoptimierung & Change Management\n- Projektleitung, Agenturakquise & -steuerung",
                "company_employees_range": "5001 - 10000",
                "company_id": "16557",
                "company_industry": "Consumer Goods",
                "company_name": "Storck",
                "company_url": "https://www.linkedin.com/company/storck/",
                "date": "1/2017 - 1/2020",
                "location": "Berlin und Umgebung, Deutschland",
                "title": "Key Account Direktor New Channel & Markant"
              },
              {
                "company_description": "- Business Planung, erfolgreiche Unternehmensgründung & -aufbau\n- Geschäftsfeldentwicklung & Aufbau von Vertriebs- & Marketingstrukturen im Health Care- & Pharmabereich \n- Social Media Marketing Kampagnen, Webseitenoptimierung & Relaunch\n- Erstellung von Pitchdecks für Investoren-Road Shows & Funding Runden sowie Durchführung von Due Dilligence für M&A Prozesse\n- Strategieberatung sowie nationales & internationales Expansionsmanagement",
                "company_employees_range": null,
                "company_id": null,
                "company_industry": null,
                "company_name": "Gameday Consulting FZ CO",
                "company_url": null,
                "date": "3/2015 - 12/2016",
                "location": "Dubai, United Arab Emirates",
                "title": "Founding Partner & Business Development Director"
              },
              {
                "company_description": "- Leitung & struktureller Aufbau der Hauptniederlassung in Dubai \n- Konzipierung von Internationalisierungsstrategien \n- Markterschließung & Geschäftsentwicklung MENA-Region \n- Markteintrittskoordination, Vertriebssteuerung, Markenaufbau, & Key Account Management\n- Business Planung & Budgetierung",
                "company_employees_range": null,
                "company_id": null,
                "company_industry": null,
                "company_name": "Business Development International FZ Co",
                "company_url": null,
                "date": "11/2013 - 1/2016",
                "location": "Dubai",
                "title": "Commercial Director & Area Sales Director"
              },
              {
                "company_description": "- Umsatz- & Budgetverantwortung\n- nationaler Roll-Out & Distributionsaufbau\n- Erschließung neuer Auslandsmärkte inkl. Akquise & Steuerung von Distributionspartnern \n- Mitarbeiterführung & -entwicklung\n- Neuekundenakquise & Key Account Management\n- Gesellschafter der Mass-Market-Produktlinie Dr. Obermann’s\n- Start-Up Gründung Vivopet",
                "company_employees_range": null,
                "company_id": "2168976",
                "company_industry": "Pharmaceuticals",
                "company_name": "PetMedical GmbH",
                "company_url": "https://www.linkedin.com/company/petmedical-gmbh/",
                "date": "10/2010 - 10/2013",
                "location": "Hannover & Unterhaching",
                "title": "Vertriebsleiter National & International"
              },
              {
                "company_description": null,
                "company_employees_range": null,
                "company_id": null,
                "company_industry": null,
                "company_name": "Plan B Communication",
                "company_url": null,
                "date": "9/2008 - 7/2009",
                "location": "Berlin und Umgebung, Deutschland",
                "title": "Project Management Consultant"
              },
              {
                "company_description": null,
                "company_employees_range": "1001 - 5000",
                "company_id": "338616",
                "company_industry": "Government Administration",
                "company_name": "Federal Ministry of Economics and Technology",
                "company_url": "https://www.linkedin.com/company/federal-ministry-of-economics-and-technology/",
                "date": "3/2009 - 4/2009",
                "location": "Berlin und Umgebung, Deutschland",
                "title": "Project Manager"
              },
              {
                "company_description": null,
                "company_employees_range": null,
                "company_id": null,
                "company_industry": null,
                "company_name": "Office of the Honorable Governor Arnold Schwarzenegger",
                "company_url": null,
                "date": "6/2008 - 8/2008",
                "location": "Sacramento und Umgebung, Kalifornien",
                "title": "Project Management Intern"
              }
            ],
            "extracted_at": "Tue, 15 Mar 2022 14:08:35 GMT",
            "first_name": "Tobias",
            "following": false,
            "full_name": "Tobias Pankow",
            "handle": "tobiaspankow",
            "headline": "Leitung Vertrieb & Key Account Management, Business Development, Strategy Consulting, M&A Prozesse, Interim Management",
            "id": "ACoAABPVCxcBgVVsJIjcy6ySm6jZ3iIkTxRzB_Y",
            "industry": "Consumer Goods",
            "job_title": "Direktor Vertrieb & Marketing / Director Sales & Marketing",
            "languages": [
              "Deutsch",
              "Englisch"
            ],
            "last_name": "Pankow",
            "linkedin_profile_url": "https://www.linkedin.com/in/",
            "location": "Berlin, Berlin",
            "meta": {
              "id_client": "16225"
            },
            "number_connections": 650,
            "number_followers": 647,
            "personal_email": null,
            "phone": null,
            "phones": null,
            "profile_country": "DE",
            "profile_language": "de",
            "profile_url": "https://www.linkedin.com/in/",
            "school_name": "Columbia University in the City of New York",
            "school_url": "https://www.linkedin.com/school/columbia-university/",
            "skills": [
              "International Sales",
              "Sales Management",
              "Operations Management",
              "Sales Operations",
              "International Expansion",
              "International Business",
              "Marketing Strategy",
              "Marketing Management",
              "Marketing Budget Management",
              "Key Account Management",
              "Key Account Development",
              "Key Account Relationship Management",
              "Key Account Acquisition & Retention",
              "International Marketing",
              "International Project Management",
              "International Market Analysis",
              "International Market Entry",
              "International Trade",
              "Distributors",
              "Bilingual Communications"
            ],
            "start_url": "https://www.linkedin.com/in/",
            "summary": "- Kommunikationsstarke Führungspersönlichkeit mit hoher Leistungsbereitschaft, Handlungsorientierung, Entscheidungsfreude, Eigeninitiative und Flexibilität\n- Fundierte nationale und internationale Erfahrung in den Bereichen Vertrieb, Aufbau und Ausbau von Netzwerken, Gewinnung von Neukunden, Business Development, Key-Account-Management, Projektmanagement (klassisch & agil) und Change \n- Aufbau von Unternehmensstrukturen und Prozessen - von der „grünen Wiese“ bis zur Expansion \n- Branchenerfahrungen und Netzwerk: FMCG, Handel, E-Commerce, Pharma & Health Care, Consulting, Start-Up und Sport\n- Nachweisbare Erfolge in diversen Firmenstrukturen - vom Unternehmensaufbau über Mittelstand bis hin zum Konzern\n- Magna cum Laude Abschluss an einer weltweit renommierten Ivy League Institution (Columbia University USA)",
            "title": "Direktor Vertrieb & Marketing / Director Sales & Marketing",
            "tracking_id": "TJsulQXfSG60e8KNBMgfSQ==",
            "twitter": null,
            "twitter_handles": [],
            "volunteer_experiences": [
              {
                "company_name": "TSV Oberhaching-Deisenhofen",
                "date": null,
                "description": null,
                "role": "Jugendtrainer Basketball"
              }
            ],
            "website": null
          }
        ]
      },
      "headers": {
        "content-type": "text/html; charset=utf-8",
        "vary": "Accept-Encoding",
        "access-control-allow-origin": "*",
        "x-cloud-trace-context": "blablablablabla",
        "date": "Mon, 28 Mar 2022 13:08:24 GMT",
        "server": "Google Frontend",
        "content-length": "249460",
        "connection": "close"
      },
      "statusCode": 200,
      "statusMessage": "OK"
    }
  ]```