Appearance
Escaping Mapped Values
INFO
Auto Escaping will be released in version 2.42.0, planned for release on 21/10/2026.
Special characters in a value mapped with Liquid can break the document it's mapped into. For example, a quote or line break breaks JSON, and a & or < breaks XML. With auto escaping turned on, AireFlow escapes each mapped value to suit its destination, so you don't need hand-written replace filters.
Turning on auto escaping
Auto escaping is set per task, with the Auto Escape Mappings switch in the task's properties. We recommend turning it on wherever possible.
- New tasks created in the designer have it turned on.
- Existing tasks have it turned off and keep working as before until you turn it on.
- Once turned on and saved, it can't be turned off again in the designer.
The setting is kept when you export and import a workflow definition or create a new version. For definitions imported from a Git repository, add "AutoEscape": true to each task in the repository, or enable it in your dev environment and re-export the definition.
Which fields are escaped
| Field | Escaping | Output for Tom & "TJ" <Jerry> |
|---|---|---|
| HTTP task body with a JSON Content-Type, and mutations | JSON | Tom \u0026 \u0022TJ\u0022 \u003CJerry\u003E |
| HTTP task body with an XML or HTML Content-Type, and emitted contexts (the Output Context field) | XML/HTML | Tom & "TJ" <Jerry> |
| Everything else, including the HTTP task URL and headers, email fields and other Content-Types | None | Tom & "TJ" <Jerry> |
- Only the output of Liquid expressions (
{{ ... }}) is escaped, not the text around them. XPath expressions aren't affected. - Non-ASCII characters are escaped too. For example,
ZürichbecomesZ\u00FCrichin JSON andZürichin XML. Parsers read these back as the original value. - When the Content-Type is JSON and the mapped body starts with
{or[, the body must be valid JSON, or the task fails withHTTP body is not valid JSON after mapping.
Examples
JSON HTTP body
Given a context where name is Tom & Jerry "TJ" and notes spans two lines, this body:
liquid
{ "name": "{{ context.name }}", "notes": "{{ context.notes }}" }produces valid JSON:
json
{ "name": "Tom \u0026 Jerry \u0022TJ\u0022", "notes": "line one\nline two" }Mutations are escaped the same way, so free text containing quotes, backslashes or line breaks can't produce an invalid patch document.
XML elements
An expression that refers to an element with child elements, such as {{ context }}, is inserted into XML and HTML output as markup rather than escaped text. Given a person element containing first and last elements:
liquid
<event>{{ context.person }}<source>form</source></event>produces:
xml
<event><first>Ann</first><last>Lee & Co</last><source>form</source></event>Line breaks in HTML
newline_to_br escapes each line, then joins them with <br />:
liquid
<p>{{ context.notes | newline_to_br }}</p>produces <p>line one<br />line <two></p>.
HTTP task URL
The URL isn't escaped automatically. Use url_encode on values in a query string or path:
liquid
https://example.com/api/search?q={{ context.search | url_encode }}For a b&c, this produces https://example.com/api/search?q=a+b%26c.
Turning escaping off with raw
To insert a value exactly as it is, such as a JSON object held in the context, use the raw filter:
liquid
"value": {{ updateContext.detailsJson | raw }}WARNING
Only use raw for values you trust to be valid in that position. Otherwise, quotes or < in the value can break the output or inject extra fields.
Previews
The expression previews for HTTP task bodies and mutations show the escaped output. Emitted contexts don't have a preview.
Moving an existing task to auto escaping
Auto escaping doesn't remove hand-written escaping, so any left in place escapes values twice. For example, | escape would turn < into &lt;.
Export the workflow definition to keep a copy. Consider making the change in a new version, because the setting applies to each version's copy of the task separately.
Remove manual escaping from the task's HTTP body, emitted context and mutations, such as:
| escape| replace: '&', '&'and similarreplacefilters for<and>| replace: '"', '\"'and otherreplacefilters that escape quotes, backslashes or newlines for JSON- the
{% capture newline %}workaround
Keep any
url_encodefilters in the URL.Turn on Auto Escape Mappings, check the previews, then save. Once saved, it can't be turned off again in the designer.