SerializeXmlNode
The JsonConvert has two helper methods for converting between JSON and XML. The first is SerializeXmlNode. This method takes an XmlNode and serializes it to JSON text.
string xml = @"<?xml version=""1.0"" standalone=""no""?>
<root> <person id=""1""> <name>Alan</name> <url>http://www.google.com</url> </person> <person id=""2""> <name>Louis</name> <url>http://www.yahoo.com</url> </person></root>";XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
//for deserialize it in to jsonstring jsonText = JsonConvert.SerializeXmlNode(doc);

Join the conversation! Your thoughts help the community grow.