node.js – How to keep empty space in xml tags as it is using xmbuilderjs2?
I am getting my xml response as below. It has empty space in between the tags.
............
<name> </name>
<address> </address>
<phone> </phone>
<zip> </zip>
.........
When I parse my XML to json using xmlbuilderjs2 using below, it converts empty strings to empty object
const data = convert(xmlData, {
format: 'object',
});
// response
{
name:{},
address: {},
phone: {},
zip: {},
}
Expected response should be empty strings like below
{
name:" ",
address: " ",
phone: " ",
zip: " "
}
How can I achieve this?
Thanks in advance.
Read more here: Source link