# XML to JSON conversion

**URL:** <https://forum.crystal-lang.org/t/xml-to-json-conversion/6184>\
**Category:** Help & Support\
**Created:** [November 26, 2023, 11:20pm UTC](https://forum.crystal-lang.org/t/xml-to-json-conversion/6184 "2023-11-26T23:20:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![perfecto25](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/perfecto25/32/1456_2.png) [@perfecto25](https://forum.crystal-lang.org/u/perfecto25)\
**Post date:** [November 26, 2023, 11:20pm UTC](https://forum.crystal-lang.org/t/xml-to-json-conversion/6184/1 "2023-11-26T23:20:51Z")

</div>

Hello, Im trying to convert a simple XML structure into a JSON object, not able to find out proper way to do it, tried JSON::BUilder but not workign correctly

want to turn this into a JSON or Hash structure

```auto
<monit id="c943df6b60bd5e0e807eeb950e7929fa" incarnation="1700966803" version="5.31.0">
  <server>
    <uptime>71885</uptime>
    <poll>5</poll>
    <startdelay>0</startdelay>
    <localhostname>mrxvivo</localhostname>
    <controlfile>/home/mreider/dev/crystal/monitbee/monit.conf</controlfile>
    <httpd>
      <address>127.0.0.1</address>
      <port>19841</port>
      <ssl>0</ssl>
    </httpd>
  </server>
</monit>

```

thanks

---

<div class="post-metadata">

**Author:** ![perfecto25](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/perfecto25/32/1456_2.png) [@perfecto25](https://forum.crystal-lang.org/u/perfecto25)\
**Post date:** [November 26, 2023, 11:32pm UTC](https://forum.crystal-lang.org/t/xml-to-json-conversion/6184/2 "2023-11-26T23:32:03Z")

</div>

found a lib that does this nicely

[https://github.com/mamantoha/xml\_converter](https://github.com/mamantoha/xml_converter)

```auto

```
