How to edit response body

I am using AWS SAM local and it returns JSON with single quotes. The JSON works fine, but looks ugly in postman. I would like to use tests or something else to edit the response body, so it look better on the body tab. Is there a way that I can intercept the response body, then edit its format, then push it back into the response window?

Hi @BamBam ,

Welcome to the community :wave:

You can solve this with a simple replace function.

var a = "[{'column1':'value0','column2':'value1','column3':'value2'}]";
var b = a.replace(/'/g, '"');

Thanks for the reply, but I want to put the new body into the body tab. Not console.

There isn’t a way that you would be able to change the formatting in the Body tab, that’s displaying what’s returned from the endpoint.

The closest that I think you could get is using the Visualizer to get the response and change the formatting before displaying that in the Visualize tab.