Skip to content

source.isJSONArray

Use when: You want to read values from the original incoming message before any mapping changes. If you need the modified message during mapping, use message.isJSONArray.

Signature: source.isJSONArray(nodePath)

Returns: Boolean matched - true if the given JSON nodePath is an array node

Find the first node that matches nodePath and evaluates if it is an array or not.

Note

This method only applies to JSON-formatted messages.

Parameters

Type Name Description Default
String nodePath the node path (XPath, HPath, Column ID, etc.)

Example

// Given a JSON source with an array-valued "children" node.
/* source:
{
    "name": "David",
    "age": 41,
    "children": []
}
*/

// Evaluate whether the node at nodePath is a JSON array.
if (source.isJSONArray('/children')) {
    // The children node is an array, so it can be iterated by index.
}