0

can any one please let me know how to convert json data to XML in titanium

Example JSON Data :

{
   msg: {
       tile:"tname",
       description:"tdescr"
  }
}

to XML as

  <?xml version="1.0" encoding="UTF-8"?>
      <msg title="name" description="tdescr" />

Thanks in Advance,

Swathi

Soumya
  • 1,350
  • 3
  • 19
  • 34
Swathi
  • 87
  • 1
  • 8
  • Check this [question](https://stackoverflow.com/q/48788722/453767) for your own solution. However using some library like json2xml, xml2js, [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) can be more helpful. – Amit Kumar Gupta Feb 17 '18 at 03:33

1 Answers1

0

This is more of a generic JavaScript question, without any peculiarities for Titanium. If you thus broaden your thinking about it, you'll find a ton of libraries that do exactly what you want -- create XML from a vanilla JavaScript object.

There's a popular library x2js, for instance:

https://github.com/abdmob/x2js

Or simply search your favorite engine (or StackOverflow) for "javascript json to xml".

Dawson Toth
  • 5,580
  • 2
  • 22
  • 37