# XML to JSON is there a library script?

**URL:** <https://community.postman.com/t/xml-to-json-is-there-a-library-script/15077>\
**Category:** Help Hub\
**Tags:** json, xml-parsing\
**Created:** [August 17, 2020, 2:27pm UTC](https://community.postman.com/t/xml-to-json-is-there-a-library-script/15077 "2020-08-17T14:27:42Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![odanylewycz](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/odanylewycz/32/3240_2.png) [@odanylewycz](https://community.postman.com/u/odanylewycz)\
**Post date:** [August 17, 2020, 3:55pm UTC](https://community.postman.com/t/xml-to-json-is-there-a-library-script/15077/2 "2020-08-17T15:55:18Z")

</div>

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) {
        console.log(result);
    });

```

That should spit out json for you.

Best,  
Orest

---

_[View the full topic](https://community.postman.com/t/xml-to-json-is-there-a-library-script/15077)._
