Mailchimp tags from an array of objects?

Hey all,

I have an array of objects and I’m trying to extract the name field of each object and use it to add a tag to a Mailchimp subscriber. My data structure is below:


Two questions;

  • I’m assuming that I need to set the “Tag” field for Mailchimp to map? And that is expecting a JSON object like so [{"name":"tagname", "value": "active"}]?

  • How would I transform my products array into that format? I’ve figured out how I can get a simple array of names, but I can’t figure out how to turn that into an array of objects with a distinct key/value (“value” = “active”, always.)

Thank you!

HI @CharlesHacks

Depends on your API call and what this expects. I would personally think it would just expect a list of tags seperated by comma or in an array; however I recommend you test this out.

You can use the “JSON” module for this. Use an iterator to go over your arrary, then an “Aggregate to JSON” module to add it all up in the structure you want.

Happy coding!

1 Like