Skip to main content

Groovy Script

responseBodyTextToClient=responseBodyTextToClient.replace('\\\"','\"').replace('\"[','[').replace(']\"',']')

Explanation

This script cleans unnecessary quote marks from JSON data in the response body:
  1. Fixing escaped quotes: Replaces \\" characters with "
  2. Cleaning start quotes: Replaces "[ characters with [
  3. Cleaning end quotes: Replaces ]" characters with ]
This operation is necessary for JSON data to be parsed correctly.
This script should be run on the response line (Response Policy) because it uses the responseBodyTextToClient variable.