Skip to content

message.isJSONArray

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

Signature: message.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 message like:
message = qie.createJSONMessage(
    JSON.stringify(
        {
            "name": "David",
            "age": 41,
            "children": []
        }
    )
);

// Check whether the node at /children is a JSON array
if (message.isJSONArray("/children")) {
    // The children node is an array, so it can be iterated by index.
}