c# json.net xml互转

json转xml:

XmlDocument doc = (XmlDocument)JsonConvert.DeserializeXmlNode(jsonText,"root");

xml转json:

XmlDocument doc = new XmlDocument();
doc.Load(xmlFileName);
string jsonText = JsonConvert.SerializeXmlNode(doc,Formatting.None,true);

猜你喜欢

转载自www.cnblogs.com/sczmzx/p/9234282.html