I have the following XML file that I need to convert to JSON. I am able to convert it to Json using Newtonsoft library but it includes xml declaration part also.How can i skip xml declaration part and convert remaining file to json?
I am using below code(C#) to convert it.
JsonConvert.SerializeXmlNode(employeeXMLDoc)
Sample xml input
<?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"}}
No comments:
Post a Comment