XML Tutorials - Herong's Tutorial Examples - v5.21, by Dr. Herong Yang
Convert XML Document to JSON Document
This section provides a quick introduction on options of converting XML documents to JSON documents: using ready-to-run tools; calling conversion libraries; and implementing your own converter.
If you have some data saved as an XML formatted document, which needs to be shared with a friend who only accepts JSON formatted documents, you have to find a way to convert your XML document to a JSON document.
You have 3 options to get the job done:
1. Find a online or offline tool to convert your XML document into a JSON document. But those ready-to-run tools follows their own conversion rules. You may not like what they generated for you and usually they don't have many options to change their behaviors. Examples of XML-to-JSON tools are:
2. Find an XML-to-JSON conversion library of your favorite programming language. Then write a short computer code to call the library to convert your XML document into a JSON document. Usually, conversion libraries offers more options than ready-to-run tools to control the output. Examples of XML-to-JSON libraries are:
3. Define your own conversion rules. Then implement those rules as a computer program in your favorite language. Here you have the full control of the output. See next tutorials on how to implement your own XML-to-JSON converter.
Table of Contents