Skip to content

message.setAllJSONNulls

Signature: message.setAllJSONNulls(nodePath)

Returns: void

Find all nodes that match nodePath and set each node to null.

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(
        {
            "people": [
                {
                    "name": "Pablo",
                    "favorite thing in the world": "wife"
                },
                {
                    "name": "Fernando",
                    "favorite thing in the world": "soccer"
                }
            ]
        }
    )
);

// Set all matching nodes to null
message.setAllJSONNulls("/people/favorite thing in the world");

// Resulting JSON:
// {
//     "people": [
//         { "name": "Pablo",    "favorite thing in the world": null },
//         { "name": "Fernando", "favorite thing in the world": null }
//     ]
// }