I have been looking into adding a JSON output method to the XML object. There are however a few challenges as not all XML and JSON structures can be accommodated.
One example is how to handle XML attributes as opposed to elements. There really is no logical equivalent in JSON so how should attributes be included? One option would be to ignore them, another might be to just include them in the JSON.
There is also a question of structure. For example in XML you could have:
In XML you can have multiple tags of the same name in the same element (think HTML which is based on XML). You cannot have multiple elements of the same name in JSON; you can have an array but you would lose the element order.
So basically, we are looking at what we could provide, however not all XML constructs can be mapped to JSON,