From Bright Pattern Documentation
• 5.19 • 5.8
Variable Parameters (escaping JSON sequences)
This section describes parameters you may add to your scenario or workflow variables.
How to Use a Variable Parameter
A variable parameter is added within the variable selector (i.e., inside the parentheses) after the variable and separated by a comma.
$(variable,parameter)
For example:
$(item.from,escapejson)
Usage Notes
- The variable parameter, but not the variable itself, is case insensitive. For example, escapejson, escapeJSON, and EscapeJson are treated the same.
- The variable parameter should not be enclosed in single or double quotes; it is considered to be part of the variable name.
- The variable parameter is allowed to have whitespaces before and/or after comma; they are trimmed out in the runtime.
- Multiple parameters cannot be invoked within the same variable.
Parameters
escapejson
When invoked, escapejson will escape (i.e., insert a backslash in front of) invalid JSON characters from the value of the variable. This includes the following:
- Double quotes (")
- Backslashes (\)
- Any control characters (e.g., \n)
For example, where $(item.from) = Pete "Maverick" Mitchell:
{"pilot": "$(item.from,escapejson)"}
The following will be returned:
{"pilot": "Pete \"Maverick\" Mitchell"}