So, you know you can request an individual attribute by using item.attribute. But what if your attribute is not a single value but an array? In the image below you can see what that looks like in the content item.
As you can see "categories" consists of 3 seperate items. Each item has it's own "categoryid" and "name".
Let's break down how you can request a value from this array.
First, request the "item.categories" value. This is identical to the way you would normally request a value.
Next, add the index of the item you want to select. Indexes start at 0, so the top one is "0", the middle one is "1" and the bottom one is "2". If you have more items this will just keep adding +1 to it. Let's request the bottom item.
Now we have item.categories.2Finally we have to select a value from the item we have selected. As mentioned before, every item here has 2 values. "categoryid" and "name". Let's request the name
Now we have {{item.categories.2.name}}The output will now display "Home Accessories"
To summarize: We request the attribute "categories" from an item. We select the 3rd item in the category with index "2" and display the value for "name":
{{item.categories.2.name}}.
For the example in the screenshot, this will output: "Home Accessories".
To loop through the array information, use the code below:
{{#each attribute}}
{{.}}
{{/each}}