XML to JSON is there a library script?

When using Quick Base APIs, Quick base delivers the payload in XML format. How can I import the library script, or find the library script that will convert that XML to JSON?

Specifically, I use the API_DoQuery in the query string of the URL along with validation token, parameters, etc.

The payload will always by default come back as XML. Can Postman provide a way to convert that to JSON notation?

Thank you,

Hi @cgreene,

Going off your other post, you can use xml2js. Something as simple as below should work:

 const xml2js = require('xml2js');   
 xml2js.parseString(pm.response.text(), function (err, result) {

That should spit out json for you.


Hi odanylewycz
Thank you for your reply and code snippet. I pasted that in the TESTS window and clicked SEND. Wondering if I’m using the code correctly as there was a problem.
Thank you again for you help. From this point I will immerse myself in study of Postman and learn this platform.
ReferenceError: xml2js is not defined

Hi @cgreene,

You’re welcome!

I didnt explain well enough in my prior response on how to use the library, my apologies. I was under the impression that the libraries were imported by default, maybe they were at some point but now you have to explicitly import them via require.

I have updated the example above, and that should work as I just tested it successfully.

Hope this helps!