well-formed

How to convert XML to JSON by using JavaScript or Java?

<p>&nbsp;</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;">Over the last years the simple data format JSON had a great inpetus in the service-oriented architecture and especially in the area of internet services. It is widely used because of its compactness and easy understandability.</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px;">&nbsp;</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;">JSON is lightweight and was used for several of my projects. However, the convertion by hand (Or by an own routine) is an unacceptable quality problem.</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px;">&nbsp;</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;">A transformation could look like the this example:</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px;">&nbsp;</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica;">The&nbsp;<strong>XML </strong>of image xml.png&nbsp;<span style="font-family: 'Trebuchet MS', sans-serif; font-size: 13px;">should be transformed to the&nbsp;<strong>JSON</strong> representation of image json.png.</span></p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px 'Trebuchet MS'; min-height: 15.0px;">So to a simple representation using curly braces.</p> <p style="margin: 0.0px 0.0px 0.0px 0.0px; line-height: 21.0px; font: 13.0px 'Trebuchet MS';"><span style="font-family: Helvetica, sans-serif; font-size: small;"><span style="font-size: 12px;"><span style="font-family: 'Trebuchet MS', sans-serif; font-size: small;"><span style="font-size: 13px;"><br /></span></span></span></span></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; line-height: 21.0px; font: 12.0px Helvetica;">JavaScript could be used to convert the data before it is passed on to the Java application. The conversion could also be done in Java itself.</p><p>&nbsp;</p>
Subscribe to well-formed