isArrayType

isArrayType(path: Path): Boolean

Returns true if the provided Path value is an ARRAY_TYPE expression.

Introduced in DataWeave version 2.4.0.

Parameters

Name Description

path

The Path value to validate.

Example

This example shows how isArrayType behaves with different inputs.

Source

%dw 2.0
import * from dw::utils::Tree
output application/json
---
{
  a: isArrayType([{kind: OBJECT_TYPE, selector: "user", namespace: null},
                  {kind: ATTRIBUTE_TYPE, selector: "name", namespace: null}]),
  b: isArrayType([{kind: OBJECT_TYPE, selector: "user", namespace: null},
                  {kind: ARRAY_TYPE, selector: 0, namespace: null}]),
  c: isArrayType([{kind: ARRAY_TYPE, selector: 0, namespace: null}])
}

Output

{
  "a": false,
  "b": true,
  "c": true
}

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub