I have the following XML file that I need to convert to JSON. I can convert it to Json using the Newtonsoft library, but also includes part of the xml declaration. How can I skip the xml declaration part and convert the remaining file to json?
I use the code below (C #) to convert it.
JsonConvert.SerializeXmlNode(employeeXMLDoc)
Xml input example
<?xml version="1.0" encoding="UTF-8" ?> <Employee> <EmployeeID>1</EmployeeID> <EmployeeName>XYZ</EmployeeName> </Employee>
Json output
{"?xml":{"@version":"1.0","@encoding":"UTF-8"},"Employee":{"EmployeeID":"1","EmployeeName":"XYZ"}}
RAHUL source share