%dw 2.0
output application/json
import * from dw::util::Values
ns ns0 http://acme.com/foo
---
index(0)
DataWeave
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.
Parameters
Name | Description |
---|---|
|
The index. |
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
Output
{
"kind": "Array",
"namespace": null,
"selector": 0
}
Json