I want to convert an XML document to a JSON object without the XML attributes. For example:
XML:
<root id="120">
<child1 id="21">val1<child1>
<child2 id="22">val2<child2>
</root>
Desired JSON:
{
"root":{
"child1": val1,
"child2": val2
}
}
Converting the XML to JSONObject, then removing each attributes seems like complex and less efficient way. Is there any recommended library or technique to achieve the same in less code and efficient way in Java?