Trying to convert any type of XML file to JSON object structure . Different xml files are having varied depths of elements and sub-elements. creation of arrays when elements wit
Please refere this
XmlMapper xmlMapper = new XmlMapper();
String xml= FileUtils.readFileToString(new File("test_4.xsd.xml"),Charset.defaultCharset());
JsonNode node = xmlMapper.readTree(xml.getBytes());
ObjectMapper jsonMapper = new ObjectMapper();
String json = jsonMapper.writeValueAsString(node);
System.out.println(json);