webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Escape \n character in API Gateway

  • 1.  Escape \n character in API Gateway

    Posted Tue August 30, 2022 12:59 PM

    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 ?


    #API-Management
    #webMethods
    #API-Gateway


  • 2.  RE: Escape \n character in API Gateway

    Posted Mon September 05, 2022 01:29 AM

    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.


    #webMethods
    #API-Management
    #API-Gateway


  • 3.  RE: Escape \n character in API Gateway

    Posted Mon September 05, 2022 04:41 AM

    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”
    }


    #API-Management
    #webMethods
    #API-Gateway