Demystifying Braze Arrays & Objects

Don’t let technical jargon like “arrays”, “objects”, or even “array of objects” scare you away.
Watch this video for a very simple explanation, and become a Braze datatype expert!
🗣️ WATCH FULL YOUTUBE VIDEO HERE 🗣
[Braze-mas 2023, Day 5]
What’s up everyone, my name is Allan, Founder and Consultant at For Now Marketing, and welcome to Day 5 of Braze-mas 2023!
Yesterday, we started talking about Braze Datatypes and covered the 4 basic datatypes: Booleans, Numbers, Strings, and Time.
Today, we’re going to continue our discussion on Braze Datatypes, and cover what I call the Advanced Datatypes: Arrays, Objects, and Arrays of Objects.
Even though I listed 3 datatypes, it’s actually only 2 unique datatypes: arrays and objects. Let’s jump in.
Datatypes
Arrays
Let’s get started with Arrays. Very simply put, an array is just a list. It’s a list of items of the same datatype. So we can have an array that represents a list of things about the user, but whatever that thing is, if the first item is a String, then all the rest of the items also have to be a String.
So referring back to the basic Braze Datatypes we covered yesterday, we can have a Array of Booleans, Numbers, Strings, or Time.
Back on our Nike website, if I navigate to the profile page, there’s an option for me to “Add Interests”. I’m gonna pick some of my favorite sports, so I pick Basketball, Pickleball, and Training & Gym. What I’ve just done is I’ve created a list of my favorite spots.
Well, how convenient, because we just talked about how an array is a list, so this information would be perfectly stored in an Array that represents a list of my favorite sports! Let’s create a String Array Custom Attribute called favorite_sports and add these values in there.
Here’s how that looks in Braze. Basketball, Pickleball, and Training & Gym, exactly what we selected on the Nike website.
Now wait a minute: that just looks like a String datatype, where the value is the whole thing: “Basketball comma Pickleball comma and Training and Gym.” What’s the difference?
So from the user profile, yes, it’s tough to distinguish whether this is just a basic String or a String array. Once again, if we navigate to Data Settings → Custom Attribute, then we can see that favorite_sports has a datatype of Array.
Well, why does it matter?
So if we chose a String datatype, then we can only have one value. We have one large answer, which is quote: Basketball comma Pickleball comma and Training and Gym unquote.
This makes it difficult to segment our audience. If we wanted to segment an audience of users whose favorite_sport equals “pickleball”, my user profile would not be selected because my favorite_sport is Basketball comma Pickleball comma and Training and Gym.
However, by using an Array, we’re allowed to add separate items or separate favorite sports to this overall list of favorite_sports, and that allows us to use each array item more flexibly within Braze. We can now segment for audiences who has “pickleball” included in their array favorite_sports.
Objects
If Arrays are lists, then Objects are groups. Objects are groups of metadata that describe the parent-level, main data. Metadata are like children-data that live under the parent-data.
Let’s say on the Nike website, I’m allowed to favorite one and only one item. I believe you can actually favorite multiple items, but for the sake of our conversation, let’s say it’s only reserved for one item.
So I found this color pair of shoes that I think would be wonderful for my new puppy. I added this item to my favorite. But when Nike wants to log this data in my User Profile, it’s important to them that they include the name, price, and the category.
It doesn’t make sense for them to create 3 separate Custom Attributes for favorite_item_name, favorite_item_price, and favorite_item_category. They just make one Object Custom Attribute called favorite_item. And within this Object data, there are 3 metadata which are: name, price, and category.
Here’s how that looks in Braze. You click “View Nested Object”, and the metadata or children data that’s nested inside this parent data called favorite_item, you can see all of that on this pop up. Very cool. I think Braze handles Object data the best in the industry.
Arrays of Objects
So we talked about Arrays which are lists and Objects which are groups. So an Array of Object, is basically just a list of groups. It’s a list that contains data groupings, or Objects. A perfect example is data to describe the current items in cart.
Back on the Nike website, I’m gonna do some shopping. Let’s add the Nike Air Max slides from yesterday to my cart, and maybe I’ll check out some hoodies, oooh this holiday one is perfect for Braze-mas, let’s add these to my cart.
But I won’t make a purchase quite yet, and Nike is definitely going to want to nudge me later on, reminding me about the items in my cart.
And what better way to store the groups of data about each item, than to use an array of objects? Here’s what that looks like in Braze.
So once again, you click Nested Object, but there is a small difference in that there are multiple groupings, verses our favorite_item data which is just an Object, and there’s only one group.
So Arrays of Objects, are pretty much just multiple Objects put together in a list, so you can keep track of multiple groups of data.
Thank you!
That’s it for Day 5.
If you have any questions, please share them in the comments. We’re happy to help! 🙏
If you learned something from this video, please subscribe for more awesome Braze videos in the future!
Thank you for watching, and see you next time!
allan@fornowmarketing.com
fornowmarketing.com