Using xml2js gives me an odd result

Hi all, first post so be gentle!

Trying to convert an XML response into JSON so I can set some collection variables using the values in there. I’m using the xml2js library but seem to be getting an odd console log which looks like it may be proxy information instead of the actual XML response (which is returned correctly). I’m not using a proxy.

image

Console Log looks like this
image

Feeling a bit bewildered but very open to the possibility that I’ve overlooked something really obvious

Any help appreciated

I think I may have solved it - it looks like I should’ve used parseStringPromise instead

image

I get the correct response in the console now

Glad you have something that is working for you.

However, why are you stringifying the response? This means you will need to parse it at some point to get to the individual keys\value within the JavaScript object. Not sure if parseString is needed at all in here.

xml2js does have a lot of options to help with the format of what is going to be returned.

What does the original XML response look like?

If you can copy and paste from the response pane using the pre-formatted text option in the forum editor, then I might be able to produce a clean JavaScript object for you to work with.

I was originally stringifying the response to troubleshoot the original problem. I’ve removed that now and have got everything working

1 Like