Modify postman response with C#

Hello everyone. I want to be able to use some C# code in postman. like splitting a csv response and adding it to a workbook. Is this possible? Thanks in advance

That’s not possible within the Postman platform.

The only language that can be used to do things like that in the sandbox environment is JavaScript.

1 Like

I had another idea. I want to set a environment variable to a csv response. right now im doing this

var data = JSON.stringify(responseBody);
postman.setEnvironmentVariable("data", data);

But this isn’t working. and if it work it sets the name of the variable to the entire response body. what am i doing wrong

This would work and add the whole response, if it’s JSON, to a variable called response:

let jsonData = pm.response.json();
pm.environment.set("response", jsonData); 

If you need a specific part of the JSON response then you would need to make a reference to it.

1 Like