message.isJSONString¶
Use when: You want to read values from the modified message during mapping. If you need the original incoming message, use source.isJSONString.
Signature: message.isJSONString(nodePath)
Returns: Boolean matched - true if the given JSON nodePath is a string node
Find the first node that matches nodePath and evaluates if it is a string or not.
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",
"age": 41,
"children": []
}
)
);
// Check whether a node is a JSON string
if (message.isJSONString("/name")) {
// The name node is a string value.
}
if (!message.isJSONString("/age")) {
// The age node is a number, not a string.
}