nashwaan / xml-js

Converter utility between XML text and Javascript object / JSON text.
MIT License
1.27k stars 181 forks source link

How to change the root tag name in json2Xml? #126

Open Aravinth-AK opened 4 years ago

Aravinth-AK commented 4 years ago

while converting my json value to xml plugin creates auto increment number as root element. eg:

<0> aadhvik001 Ashok@123 <1> ashok0001 Ashok@123 <2> ashok001 Ashok@123 <3> daldad001 Ashok@123

i need to replace this with some default label like:

daldad001 Ashok@123

how can i achieve this?

ghost commented 2 years ago

The XML is incrementing them so it knows they are separate. Can you create an array and after each conversion, push the result into the array? That way the XML doesn't have to separate them, the array does.