> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://support.pdfgeneratorapi.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to access a specific array element?

It is possible to use expression language to access specific items in an array if a numeric keys are used. The array can contain strings, number or objects.

**Access array at index 1**
```
{% {array_with_strings}[1] %} => "test_2"
```

**Access array at index 1 and display value of "item"**
```
{% {array_with_objects}[1]["item"] %} => "test_2"
```

|| Object keys must be wrapped with double quotes, while numeric array keys should not be.

###### Example JSON

```
{
  "array_with_objects": [
    {
      "item": "test"
    },
    {
      "item": "test_2"
    }
  ],
  "array_with_strings": [
    "test",
    "test_2"
  ]
}
```

###### Accessing sub-items in the array

| N.B. In expression language, the sub-items are accessed with brackets.

For example, you need to access the value of a location name in your line items meta fields and set the condition to trigger the rule if there is at least one item with the value of location name "abc".

![](https://storage.crisp.chat/users/helpdesk/website/11e0e518fc48ce00/clanok_123fk7c.png)

The expression would be:

`count(filter({line_items}, 'line_item_metafields["location_name"]["value"] == "abc"')) > 0`
---
### Related articles you may find helpful

* [Is it possible to conditionally change the component style or hide the component?](https://support.pdfgeneratorapi.com/en/article/is-it-possible-to-conditionally-change-the-component-style-or-hide-the-component-z8nmwg/)
* [List (array) functions](https://support.pdfgeneratorapi.com/en/article/list-array-functions-1xlxhsw/)
* [Table Component](https://support.pdfgeneratorapi.com/en/article/table-component-1fuaafc/)
