API Connect

 View Only
  • 1.  Escape \ in incoming JSON body

    Posted Mon November 23, 2020 08:28 AM

    Hello Team,

    Backend is returning error response with \" as shown below -
    { "error" : "400 \"Bad \n Request\""}
    And when APIC is reading this response it is removing the slash (\) and then sending it to consumers like below -
    { "error" : "400 "Bad
    Request""}
    How can we retain escape characters (\ or \n) while reading the response?

    NOTE: We already have this property added for the API to escape the Unicode : x-ibm-gateway-api-json-parse-error-handling = escape-unicode.

    Thanks & Regards,
    Shweta


    ------------------------------
    Shweta Revankar
    ------------------------------


  • 2.  RE: Escape \ in incoming JSON body

    Posted Tue November 24, 2020 08:07 AM
    Converting \" into " is the default JSON behavior.
    Do you have some more API Properties like x-ibm-gateway-framework-preserve-escaped-reverse-solidus
    How did you find out, that APIC changes the response message?

    To escape \ you could work with \\
    To escape \n you could work with \\n
    You may have to do some try and error

    ------------------------------
    Matthias Jungbauer
    ------------------------------