0

I am successfully using the /asset/v1/content/assets REST API to populate a data extension with information about all the images in my business unit, via an SSJS script in Automation Studio. However, the tags attribute is an array, and when I attempt to populate the DE with it, the DE displays "System.Collections.ArrayList".

As I loop through the assets, I am grabbing the tags attribute with:

var assetTags = finalResponseFinal.items[i].tags;

This will ultimately feed a cloudpage that will allow users to search images, with tags being one of the elements they can filter on.

What should I do with the tags to populate the DE, and how do I do it? I am not versed in javascript, so a clear, complete answer would be most helpful. I have tried to stringify and .toString it but neither worked.

Thanks

1 Answer 1

0

Bring this from my comment:

Actually you don't need to create a Cloudpage for searching, MC users can always use the filter option (funnel icon at the top right in Content Builder) to filter based on image type and tag.


You cannot add an array to a Data Extension field. The array value needs to be turned into a String data type to add into the DE.

You can try like this, it will display the array in the DE:

var assetTags = finalResponseFinal.items[i].tags;
    assetTags = Stringify(assetTags);
.....

Note: the value now is turned into a String and it's not an array anymore.

2
  • Thanks, I thought I had tried that but I must have munged it because your suggestion worked. Now I see I'm getting tag IDs, not the tag names themselves, so on to the next step to figure out how to translate those into the tag names.
    – jwb96
    Commented Mar 15 at 17:42
  • @jwb96 Actually you don't need to create a Cloudpage for searching, MC users can always use the filter option (funnel icon at the top right in Content Builder) to filter based on image type and tag. If you find the answer helpful, kindly mark it as the accepted answer.
    – Duc Le
    Commented Mar 16 at 1:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .