%dw 2.0
import * from dw::core::Types
type ArrayOfString = Array<String>
type ArrayOfNumber = Array<Number>
type ArrayOfAny = Array<Any>
type ArrayOfAnyDefault = Array
output application/json
---
{
a: arrayItem(ArrayOfString),
b: arrayItem(ArrayOfNumber),
c: arrayItem(ArrayOfAny),
d: arrayItem(ArrayOfAnyDefault)
}
DataWeave
arrayItem
arrayItem(Type): Type
Returns the type of the given array. This function fails if the input is not an Array type.
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to check. |
Example
This example shows how arrayItem
behaves with different inputs.
Source
Output
{
"a": "String",
"b": "Number",
"c": "Any",
"d": "Any"
}
Json