Cleaning Quote (\"\") Marks from JSON Data with Replace Script
Groovy Script
responseBodyTextToClient=responseBodyTextToClient.replace('\\\"','\"').replace('\"[','[').replace(']\"',']')
Explanation
This script cleans unnecessary quote marks from JSON data in the response body:
- Fixing escaped quotes: Replaces
\\"characters with" - Cleaning start quotes: Replaces
"[characters with[ - Cleaning end quotes: Replaces
]"characters with]
This operation is necessary for JSON data to be parsed correctly.
not
This script should be run on the response line (Response Policy) because it uses the responseBodyTextToClient variable.