Remove Escape Characters
Verb: unescapeData
Removes the escape characters that are in the text, leaving it in plain text or JSON format.
Syntax
unescapeData --data(String) [--json(Boolean)] (String)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--data | Text | Required | Text | Text containing escape characters that will be removed. |
--json | Text as JSON | Optional | Boolean | When enabled, it allows the content of the Text parameter to be considered in JSON formatting. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
value | Unescape Data | Text | Returns the text in its simple or JSON format, without the escape characters. |
Example
Example 1: Removes escape characters from text, causing it to return to its original value.
defVar --name escapedText --type String
defVar --name unescapedText --type String
escapeData --data "Characters that convey important information." escapedText=value
logMessage --message "Data converted to escape: ${escapedText}" --type "Info"
unescapeData --data "${escapedText}" unescapedText=value
logMessage --message "Data converted back to the original characters:${unescapedText}" --type "Info"
//Returns the following output in the console:
//Data converted to escape: Characters%20that%20convey%20important%20information.
//Data converted back to the original characters:Characters that convey important information.
Example 2: After adding escape characters to text in JSON format, the Remove Escape Characters command processes this data, so that it can be returned to its original structure.
defVar --name escapedText --type String
defVar --name unescapeText --type String
escapeData --data "{\"Name\": \"John\", \"LastName\": \"Doe\", \"Age\": 199}" --json escapedText=value
logMessage --message "Data converted to escape: ${escapedText}" --type "Info"
unescapeData --data "${escapedText}" --json unescapeText=value
logMessage --message "Data converted back to the original characters: ${unescapeText}" --type "Info"
//Returns the following output in the console:
//Data converted to escape: "{\"Name\": \"John\", \"LastName\": \"Doe\", \"Age\": 199}"
//Data converted back to the original characters: {"Name": "John", "LastName": "Doe", "Age": 199}