Layer7 API Management

  • 1.  How do you escape special characters in regular expressions in 8.2 version? 

    Posted Aug 25, 2017 02:24 PM

    In my json response for a field value there are special characters being returned which is not supported by json. For example : "Description": "7/16\"-14 x 6 ft ASTM A193 Gr B7 Plain Threaded Rod". The \" in in the description value is causing issues. This is how json is returning the response but CA gets rid of \ from the response when returning result which is causing the issue. Is there a way to escape these special characters in the Regular Expression Assertion? I tried this below and it didn't seem to resolve the problem.

     



  • 2.  Re: How do you escape special characters in regular expressions in 8.2 version? 

    Posted Sep 07, 2017 06:55 PM

    Just out of curiosity, is the content-type of the JSON response properly set to "application/json" before it is parsed by the API Gateway?



  • 3.  Re: How do you escape special characters in regular expressions in 8.2 version? 

    Broadcom Employee
    Posted Sep 08, 2017 12:25 AM

    Dear Parbati ,

    '\' is also a special char, please try

    \\"

     

    Regards,

    Mark



  • 4.  Re: How do you escape special characters in regular expressions in 8.2 version? 
    Best Answer

    Posted Sep 08, 2017 08:21 AM

    Yes the content type was set correctly. I have the 8.2 version of layer 7 and it turns out I have to define the content variable as description.result so that it would apply the proper escape character. 

     

    I figured it out now. Thank you all for the suggestions.