Is there a way to convert a xml file to json? The XML can be of any structure, therefore there is no POJO class for instantiation. I need to convert the xml to json or to a Map, without root nodes.
For example:
<import name="person">
<item>
<firstName>Emil</firstName>
<lastName>Example</lastName>
<addresses>
<address>
<street>Example Blvd.</street>
</address>
<address>
<street>Example Ave.</street>
</address>
</addresses>
</item>
</import>
Expected JSON
{
"firstName": "Emil",
"lastName": "Example",
"addresses": [
{ "street" : "Example Blvd." },
{ "street" : "Example Ave." }
]
}
I am used JSON-java but I found more Efficient Library to Convert
XML
toJson
is XmlToJsonWhich is Given Best Customization to making
Json
fromXML
Add the
libary
dependency to your APPbuild.gradle
fileCustom Content names
Custom Attributes names
and Much More Efficient Techniques to Customize your Json
Click here to Check out on Github