Skip to content

message.isJSONNull

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

Signature: message.isJSONNull(nodePath)

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

Find the first node that matches nodePath and evaluates if it is a null value 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": null
        }
    )
);

// Check whether a node is explicitly null
if (message.isJSONNull("/age")) {
    // The age node was sent as an explicit null rather than omitted.
}

if (!message.isJSONNull("/name")) {
    // The name node carries a value.
}