Add Escape Characters to Text
Verb: escapeData
Adds escape characters to text in plain or JSON format.
Syntax
escapeData --data(String) [--json(Boolean)] (String)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--data | Text | Required | Text | Plain or JSON format text to which the escape characters will be added. |
--json | Text is JSON | Optional | Boolean | When enabled, it allows the content in the Text parameter to be considered in JSON formatting. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
value | Escaped Data | Text | Returns the text with the added escape characters. |
Example
Example 1: The command adds escape characters to the text "Characters that convey important information".
defVar --name escapedData --type String
escapeData --data "Characters that convey important information." escapedData=value
logMessage --message "Data converted to escape: ${escapedData}" --type "Info"
// Returns the following output in the console:
// Data converted to escape: Characters%20that%20convey%20important%20information.
Example 2: In this scenario, the command adds escape characters to the text "{" Name ":" John "," LastName ":" Doe "," Age ": 78}", in JSON format.
defVar --name escapedData --type String
escapeData --data "{\"Name\": \"John\", \"LastName\": \"Doe\", \"Age\": 78 }" --json escapedData=value
logMessage --message "Data converted to escape: ${escapedData}" --type "Info"
// Returns the following output in the console:
// Data converted to escape: "{\"Name\": \"John\", \"LastName\": \"Doe\", \"Age\": 78 }"