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

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