message.addNullToJSONArray¶
Signature: message.addNullToJSONArray(nodePath)
Returns: void
Find the first ArrayNode that matches nodePath and adds a null 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.) |
Example¶
// Given a JSON message like:
message = qie.createJSONMessage(
JSON.stringify(
{
"name": "David",
"colors": [
"blue",
"green"
]
}
)
);
// Add a null value to the array at nodePath
message.addNullToJSONArray(
"/colors" // nodePath to the JSON array
);
// Resulting JSON:
// {
// "name": "David",
// "colors": [
// "blue",
// "green",
// null
// ]
// }