views:

108

answers:

1

Hi,

Does anyone know of a good solution to convert from XML to JSON and then back to XML?

I found two tools for jquery, xml2json & json2xml.

Each of these works very well - however, the conversions they use aren't 100% consistent.

Has anyone encountered this situation before?

+1  A: 

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 (linked to at the bottom). The writer 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.

Josh Stodola
thanks for the reply! In my case, the JSON is the canonical representation, and XML is just used for XSLT.. the use of which is not my idea! :)
Jason Denizac