How would you convert from XML to JSON and then back to XML?
The following tools work quite well, but aren't completely consistent:
Has anyone encountered this situation before?
How would you convert from XML to JSON and then back to XML? The following tools work quite well, but aren't completely consistent: Has anyone encountered this situation before? |
|||||||||||||||||||||
|
I think this is the best one: Converting between XML and JSON Be sure to read the accompanying article on the xml.com O'Reilly site, which goes into details of the problems with these conversions, which I think you will find enlightening. The fact that O'Reilly is hosting the article should indicate that Stefan's solution has merit. |
|||||||||||||||||||||
|
http://code.google.com/p/x2js/ - my own library:
Online Demo on http://jsfiddle.net/abdmob/gtLBx/15/
|
|||||||||||||||||||||
|
These answers helped me a lot to make this function:
As long as you pass in a jquery dom/xml object: for me it was:
where content was the field I was storing my xml in. |
||||
|
for xml2json library : input as 'text' is giving below stated output
why "undefined" is coming in object? |
|||||||||
|
A while back I wrote this tool https://bitbucket.org/surenrao/xml2json for my TV Watchlist app, hope this helps too.
|
|||||||||
|
The best way to do it using server side as client side doesn't work well in all scenarios. I was trying to build online json to xml and xml to json converter using javascript and I felt almost impossible as it was not working in all scenarios. Ultimately I ended up doing it server side using Newtonsoft in ASP.MVC. Here is the online converter http://techfunda.com/Tools/XmlToJson |
|||
|