Converting Json Data to Xml Data:
public void xmlSerialize()
{
string json = "{'total': 1, 'city': { 'name': 'Zaafaranah, Red Sea, Egypt, EG', 'dest_code': 'D!001031', 'country': 'EG', 'code': 'C!000001'} }";
System.Xml.XmlDocument xmlDocument = Newtonsoft.Json.JsonConvert.DeserializeXmlNode(json, "city");
System.Xml.XmlTextWriter xmlTextWriter = new System.Xml.XmlTextWriter("json.xml", null);
xmlTextWriter.Formatting = System.Xml.Formatting.Indented;
xmlDocument.Save(xmlTextWriter);
}
public void xmlSerialize()
{
string json = "{'total': 1, 'city': { 'name': 'Zaafaranah, Red Sea, Egypt, EG', 'dest_code': 'D!001031', 'country': 'EG', 'code': 'C!000001'} }";
System.Xml.XmlDocument xmlDocument = Newtonsoft.Json.JsonConvert.DeserializeXmlNode(json, "city");
System.Xml.XmlTextWriter xmlTextWriter = new System.Xml.XmlTextWriter("json.xml", null);
xmlTextWriter.Formatting = System.Xml.Formatting.Indented;
xmlDocument.Save(xmlTextWriter);
}
No comments:
Post a Comment