Skip to content

message.isJSONBoolean

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

Signature: message.isJSONBoolean(nodePath)

Returns: Boolean matched - true if the given JSON nodePath is a boolean node

Find the first node that matches nodePath and evaluates if it is a boolean 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": 44,
            "active": true
        }
    )
);

// Check whether a node is a JSON boolean
if (message.isJSONBoolean("/active")) {
    // The active node holds a true/false value.
}

if (!message.isJSONBoolean("/age")) {
    // The age node is a number, not a boolean.
}