This operation is used to encode or "escape" characters in a string so that they can be safely used in different contexts, such as URLs, JSON, HTML, or code. This operation is helpful when you need to format text with special characters in a way that won’t break syntax or cause unintended effects in various data formats.
Data types
These are the input/output expected data types for this operation:
Input data
- Strings with the characters you want to escape.
Output data
- Strings with the required escaped characters.
Parameters
These are the parameters you need to configure to use this operation (mandatory parameters are marked with a *):
Escape Level*
Choose how to control the extent of character escaping applied to the input. Enter one of the following:
Everything - Escapes all characters that could potentially have any impact in the selected format, including less common or optional characters.
Special chars - Escapes only a specific set of characters that have special meanings in the chosen format.
1. JSON – Special Characters Escape Level
In addition to the minimal set (", \, control characters), it may include:
Minimal - Escapes only the characters that are strictly necessary to make the string safe for the specific format.
1. JSON (Minimal Escape)
" (double quote) because it delimits strings
\ (backslash) because it’s used as an escape character
Control characters: \b, \f, , ,
Example:
jsonCopyEdit{ "message":"He said: \"Hello!\"" }
2. HTML (Minimal Escape)
< – to prevent tag injection
> – to prevent broken tags
& – to prevent character entity confusion
" – if used inside attribute values wrapped in double quotes
' – if used inside attribute values wrapped in single quotes
Example:
htmlCopyEdit<ahref="page.html?msg=Hello & Welcome">Link</a>
3. XML (Minimal Escape)
<, >, &, ', " – for both content and attribute values
Escape Quote*
This parameter lets you specify how to handle quote characters (" and ') within the input text. Enter one of the following:
Single - Escapes only single quotes (') in the input.
Double - Escapes only double quotes (") in the input.
Backtick - Escapes only backticks (`) in the input.
JSON compatible
Set this parameter to true if you need to use the output string in a JSON. This ensures that any characters with special meanings in JSON are escaped properly, allowing the resulting string to be safely embedded in JSON objects or arrays.
Example
Suppose you want to escape characters that are between " ina series of input strings. To do it:
In your Pipeline, open the required Action configuration and select the input Field.
In the Operation field, choose Escape String.
Set Escape Level to Special chars.
Set Escape Quote to Double.
Set JSON compatible to false.
Give your Output field a name and click Save. Matching characters will be escaped. For example:
She said, "Hello, world!" -> She said, \"Hello, world!\"
You can try out operations with specific values using the Input field above the operation. You can enter the value in the example above and check the result in the Output field.