Skip to content

message.addNullToJSON

Signature: message.addNullToJSON(nodePath, childNode)

Returns: void

Add a 'Null' to the first node that matches nodePath.

Note

This method only applies to JSON-formatted messages.

Parameters

Type Name Description Default
String nodePath the node path (XPath, HPath, Column ID, etc.)
String childNode the name of the child node to add

Example

// Given a JSON message like:
message = qie.createJSONMessage(
    JSON.stringify(
        {
            "name": "David",
            "age": "44",
            "favorite food": "Italian"
        }
    )
);

// Add a null value to an existing child node
message.addNullToJSON("/", "favorite food");

// Resulting JSON:
// {
//     "name": "David",
//     "age": "44",
//     "favorite food": null
// }