Skip to content

message.addBooleanToJSONArray

Signature: message.addBooleanToJSONArray(nodePath, value)

Returns: void

Find the first ArrayNode that matches nodePath and adds this value to the array.

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 or Boolean value the new node value

Example

// Examples of how to use addBooleanToJSONArray
// Given a JSON message like:
message = qie.createJSONMessage(
   JSON.stringify(
      {
         "name": "Harold",
         "age": 44,
         "trueFalseArray": []
      }
   )
);


// Example: value as Boolean
message.addBooleanToJSONArray(
   "/trueFalseArray", // nodePath - path to the JSON array
   true               // value (Boolean)
);
message.addBooleanToJSONArray(
   "/trueFalseArray",
   false
);


// Example: value as String (will be converted to Boolean)
message.addBooleanToJSONArray(
   "/trueFalseArray",
   "true"             // value (String → Boolean)
);

// Resulting JSON:
// {
//     "name": "Harold",
//     "age": 44,
//     "trueFalseArray": [true, false, true]
// }