Jira Automation smart value
htmlEncode, xmlEncode, jsonEncode, quote(): examples
These functions escape text for the place it is going to. htmlEncode is for HTML emails, xmlEncode for XML payloads, jsonEncode for JSON request bodies, and quote() turns a value into a literal for a regular expression.
Syntax
{{htmlEncode(issue.summary)}}
{{xmlEncode(issue.summary)}}
{{issue.summary.jsonEncode}}
{{#jsonEncode}}{{issue.summary}}{{/}}
{{issue.summary.quote()}}
Works on
- Fields: any text value
- Returns: the escaped text
Examples
{{htmlEncode(issue.summary.concat(" R&D <b>bold</b>"))}}Escapes ampersands and angle brackets so an HTML email shows the text instead of running it as markup.
Result:
Hello World! R&D <b>bold</b>Run on Jira Cloud on .
{{htmlEncode(issue.summary.concat(" says \"hi\""))}}Double quotes become ", which matters inside an HTML attribute.
Result:
Hello World! says "hi"Run on Jira Cloud on .
{{#xmlEncode}}{{issue.summary}} & <b>{{/}}The block form of xmlEncode, for an XML webhook body.
Result:
Hello World! & <b>Run on Jira Cloud on .
{{issue.summary.concat(" says \"hi\"").jsonEncode}}Escapes the double quotes with a backslash so the value fits inside a JSON string.
Result:
Hello World! says \"hi\"Run on Jira Cloud on .
{{issue.summary.concat(" (.*)").quote()}}Wraps the value so a regular expression treats the brackets and the star as plain characters.
Result:
\QHello World! (.*)\ERun on Jira Cloud on .
{{issue.summary.concat(" & <b>").jsonEncode}}JSON escaping leaves ampersands and angle brackets alone, so it is not a substitute for htmlEncode.
Result:
Hello World! & <b>Run on Jira Cloud on .
Where the documentation differs
{{htmlEncode(issue.summary)}}Run on Jira Cloud, : the documentation says
Hello world!, the actual result isHello World!.{{issue.summary.quote()}}Run on Jira Cloud, : the documentation says
\QHello(.*)World!\E<, the actual result is\QHello World!\E.
Pitfalls
- Use the function form for htmlEncode. Atlassian warns that an inline form can pick up a property of the same name from a webhook payload instead of encoding it. The inline
.htmlEncodedid encode a summary when checked on Jira Cloud in November 2026. - Each encoder only fits its target. HTML encoding turns a double quote into
", JSON encoding turns it into\", and JSON encoding leaves&and angle brackets as they are. - An example in Atlassian's page for quote() shows
\QHello(.*)World!\E<for a summary that does not contain those characters. With a summary of Hello World! the result is\QHello World!\E(checked on Jira Cloud, November 2026). - quote() works without the brackets as well, and wraps the whole value, so a sentence with a question mark or a bracket can be searched for literally.
Questions and answers
Which encoder should I use for the Send web request action?
Use jsonEncode for values placed inside a JSON body. Atlassian's page describes it for outgoing web requests, and the block form {{#jsonEncode}}...{{/}} escapes quotes in text around smart values as well.
Related
- urlEncode
- replace(), replaceAll() and remove()
- match()
- asJsonString, asJsonStringArray, asJsonArray
- asJsonObject(), xmlToJson(), jsonStringToObject()
- concat()