Escape \n character in API Gateway

Hi Everyone,
I try to map payload to the response with special character \n contain in request. My expectation are ,response data not parsed the special character \n to new line. I have assign the response value with variable format “${request.body.client_id}”

How to escape special character to keep the original format data ?

Hi Rahmat,
Have you tried this property? Reverb

watt.server.json.decode.unescapeSpecialChars

Controls whether Integration Server unescapes the special characters ‘\n’, ‘\r’, ‘\t’, ‘\b’, ‘\f’, ‘\’, ‘"’ while parsing JSON documents. If this parameter is set to true, then Integration Server unescapes these special characters (that is, ‘\n’ will be replaced with new line, similarly other characters will also be replaced) in the output document. If this parameter is set to false then Integration Server keep these characters as is in the output document. The default value for this server property is true.

Regards.

Hi Prabavathy,
Yes, I have try with watt.server.json.decode.unescapeSpecialChars but all special character in payload structure escaped. How to apply escaped only on variable value and keep payload field ?
ex :
Before :
{
“responseCode”:“1
2”
}

After :
{\\\\\\\\\\\\\\\\\\“responseCode”:“1\n2”\\\\\\\\\\\\\\\}

Expect :
{
“responseCode”:“1\n2”
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.