# Xml node string to boolean conversion

**URL:** <https://discourse.nodered.org/t/xml-node-string-to-boolean-conversion/70590>\
**Category:** General\
**Created:** [14 November 2022 14:26 UTC](https://discourse.nodered.org/t/xml-node-string-to-boolean-conversion/70590 "2022-11-14T14:26:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![psmtvdw](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@psmtvdw](https://discourse.nodered.org/u/psmtvdw)\
**Post date:** [14 November 2022 14:26 UTC](https://discourse.nodered.org/t/xml-node-string-to-boolean-conversion/70590/1 "2022-11-14T14:26:49Z")

</div>

Hi,

I am using the XML node to convert an XML formatted string to js object. How can I convert an element value formatted as string ("true", "false") to a **boolean** datatype in the js object?  
in the [xml2js docs](https://github.com/Leonidas-from-XIV/node-xml2js/blob/master/README.md#options) there seems to be an out-of-the-box processor called **parseBooleans**

I am aware of the msg.options input in the XML node. (I use it for things like **explicitArray** )  
**valueProcessors** is another option but this needs an Array of functions as it's value.  
My question: is it possible to use this option? if so, how should I format the options message?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [13 January 2023 14:27 UTC](https://discourse.nodered.org/t/xml-node-string-to-boolean-conversion/70590/2 "2023-01-13T14:27:40Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
