Skip to main content

$(jsonEscape)

$(jsonEscape [text])

Escapes text so it can sit safely inside a JSON string literal — quotes, backslashes and newlines are escaped. The surrounding quotes are not added; write those in your template. Most useful in flows when building a webhook payload with the Generate Text node.

Examples

$(jsonEscape say "hi")

Will display say \"hi\"

{ "message": "$(jsonEscape {{message}})" }

Will produce valid JSON even when the chat message contains quotes