[] Operator
Retrieves the value at a specified index (applies to: str, list, map) or xpath (applies to: xml).
Usage Restrictions
1.8.1 or later.
Samples
| | Output |
| To retrieve the second character in a string:
{{ "Hello World!"[1] }} | | e |
| To retrieve the first value in a list:
{{ [ 1, 2, 3 ][0] }} | | 1 |
| To retrieve a map item at a specified index name:
{{ { first: 1, second: 2, third: 3 }["third"] }} | | 3 |
| To retrieve the username element returned from the API using an xpath:
{{ web.xml("http://wiki.opengarden.org/@api/deki/users")["user/username"] }}
| | |