# Trouble reading from JSObject created from XML

**URL:** <https://discourse.nodered.org/t/trouble-reading-from-jsobject-created-from-xml/75947>\
**Category:** General\
**Created:** [1 March 2023 15:36 UTC](https://discourse.nodered.org/t/trouble-reading-from-jsobject-created-from-xml/75947 "2023-03-01T15:36:43Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Darren](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/darren/32/92202_2.png) [@Darren](https://discourse.nodered.org/u/Darren)\
**Post date:** [2 March 2023 13:36 UTC](https://discourse.nodered.org/t/trouble-reading-from-jsobject-created-from-xml/75947/5 "2023-03-02T13:36:01Z")

</div>

E1cid's solution works, I only edited `type_name` to:

```auto
type_name: Object.keys(obj_variable.type[0]).toString(),

```

which will pick out BOOL, INT, etc. from the horridly formatted XML. This was based off [array to string on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString).

My original code was inspired by [this post by Steve-Mcl](https://discourse.nodered.org/t/array-to-json-object/46261/2) (and I just noticed you chimed in with a similar fix back then, too, E1cid!)

Thank you so much!

---

_[View the full topic](https://discourse.nodered.org/t/trouble-reading-from-jsobject-created-from-xml/75947)._
