How to convert the body of a TXT or XML request to JSON?
You can use native transformation interceptors to do this. With them, it’s possible to convert both the request and response body from XML or TXT to JSON and vice versa.
|
Alternatively, you can also create a Custom JavaScript interceptor for this function.
Go to API Design > Interceptors and follow the steps:
-
In the Custom Interceptors section, access your Custom JavaScript or create a new one;
-
In the editor, enter the script:
const objRequestBody = JSON.parse(strRequestBody);
-
Click on Save to keep the change.
See the gif below with these steps:
Share your suggestions with us!
Click here and then [+ Submit idea]