---
schema_version: "1"
id: b9c255be746f7869886549da2983d425efb6aaa95f63e375f283affcb763a50e
title: index
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.12/dw-values-functions-index.md
canonical_url: https://docs.mulesoft.com/dataweave/2.12/dw-values-functions-index
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 46d396b8a8ac0e6d740e9d9f6ddf02f1e57df5bf7fa9bbefe3153712e46b6599
description: MuleSoft Documentation Site
release: "2.12"
latest: false
---
---
product: DataWeave
version: 2.12
---

# index

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## index(index: Number): PathElement

This function creates a `PathElement` data type to use for selecting an _array element_ and
populates the type’s `selector` field with the specified index.

Some versions of the `update` and `mask` functions accept a `PathElement` as an argument.

_Introduced in DataWeave version 2.2.2._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>index</code></p></td><td><p>The index.</p></td></tr></tbody></table>

### Example

This example creates an selector for a specified index. It sets the selector’s value to `0`. In the
output, also note that the value of the `"kind"` key is `"Array"`.

#### Source

```DataWeave
%dw 2.0
output application/json
import * from dw::util::Values
ns ns0 http://acme.com/foo
---
index(0)
```

#### Output

```Json
{
   "kind": "Array",
   "namespace": null,
   "selector": 0
 }
```
