How to send Array Aggregator output as proper JSON array to Apify IG Scarping Actor?

Hi everyone,

I’m running into an issue when trying to send usernames from an Array aggregator into the Apify → Run Actor module (Instagram Profile Scraper).

Here’s the problem:

  • I collect usernames with Array aggregator.

  • When I pass them into the Actor’s Input JSON, they don’t format correctly.

Instead of this (what I need):

{
  "usernames": [
    "humansofny",
    "thedankoe"
  ]
}

I get this (what it currently outputs):

{
  "usernames": [
    "marajanecabanglan, restorationretreats"
  ]
}

Here is how I mapped it:

Here is the whole scenario:

Here is scenario:

Integration Apify.blueprint.json (37.0 KB)

I need the usernames to stack under each other with commas. Like in the mapping from the scraper in Apify:

I have no experience in formatting so it becomes kinda hard.

If someone has any solution, would be a great help. Thanks.

Hey @Boijdingo , the array aggregator data is output in json, therefore, you do not need to do any additional formatting.

You just map the array directly. it works.

Hi @Boijdingo,

You’ll need to use a replace() function to split your string and format it properly:

{
“usernames”: [{{replace(map(12. Array ; ownerUsername), “,”, ‘", "’)}}]
}

Here is the explanation:

  • map(12. Array[] ; ownerUsername) extracts the usernames, which are originally comma-separated.

  • The replace() function changes the commas , to ", " (a comma between quotes), allowing the usernames to be correctly parsed into individual elements.

Let me know if you need further clarification!
If this helps, kindly mark it as a solution :+1: