message.addJSONStringAfter¶
Signature: message.addJSONStringAfter(nodePath, childNode, value)
Returns: void
Add the specified childNode 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 | |
| String | value | the value of the child node to add |
Example¶
// Given a JSON message like:
message = qie.createJSONMessage(
JSON.stringify(
{
"name": "Kacie",
"age": 44
}
)
);
// Add a string child node immediately AFTER the node at nodePath
message.addJSONStringAfter(
"/name", // nodePath to insert after
"favorite place", // name of the child node
"St. George" // value of the child node
);
// Resulting JSON:
// {
// "name": "Kacie",
// "favorite place": "St. George",
// "age": 44
// }