Is there any way to parse xml response in postman flows?

Your question may already have an answer on the community forum. Please search for related topics, and then read through the guidelines before creating a new topic.

Here’s an outline with best practices for making your inquiry.

My question:
Hi Team,
I send the request and receive a body response as below picture.
I want to parse the error message in the body.response but cannot.
Is there any way to parse xml response in postman flows ?
Please help me solve this.
Thank you so much.

Details (like screenshots):

How I found the problem:

I’ve already tried:

Hey @giangdo11, the Send Request block does support parsing xml responses. You might have to manually set it to XML.

Hi @saswatds
Thank you for your reply.
I tried as you said but the SELECT block cannot parse XML in body.response.
In the collections, I can convert body.response to Json then it can parse the error-message in the Tests as below:

var responseJson = xml2Json(pm.response.json().response);
if (pm.response.json().error == true) {
  pm.environment.set("error-message", responseJson["rpc-reply"]["rpc-error"]["error-message"]);

Can we run the script like that in postman flows? Or Does Postman flows support convert xml2Json as script?

1 Like