Convert XML to JSON (and back) using Javascript

Jason Suárez picture Jason Suárez · Nov 20, 2009 · Viewed 386.9k times · Source

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?

Answer

Josh Stodola picture Josh Stodola · Nov 20, 2009

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.