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

# 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
 }
```
