Lava Filters - Index
Category:Arrays
Description:Provides an easy way to retrieve an item from an array using its index when chaining filters.
Input: "CurrentPerson": {
"PhoneNumbers": [
{
"NumberFormatted": "(555) 555-5551"
},
{
"NumberFormatted": "(555) 555-5552"
},
{
"NumberFormatted": "(555) 555-5553"
}
]
}
Lava: {% assign secondPhone = CurrentPerson.PhoneNumbers | Index:1 %}
{{ secondPhone.NumberFormatted }}
Output: (555) 555-5552