convert JSON object to XML using javascript
16,591
Solution 1
You can try this small library http://code.google.com/p/x2js/
Solution 2
There is no unique way of doing this. You should be using XML with a schema only, and JSON doesn't have such a schema. Any such transformation when done naively is likely to break.
Why don't you just use XML or JSON consequently?
Solution 3
You can use the external js available by google named x2js.js
You can see the demo over here.
Author by
Andrew M
Updated on July 15, 2022Comments
-
Andrew M almost 2 years
I want to convert a JSON object to a XML String and I can't figure a proper way to do it. I've found a neat little jQuery plugin called json2xml at https://gist.github.com/c4milo/3738875 but it doesn't escape the data.
How can I escape the data properly so that the browser's XML parser will work?