Thinkai's Blog

Autohotkey|Python|php|aardio|VOIP|IT 爱好者

xml、json互转 C# 2781

作者为 发表

编程

 using System;
 using System.Xml;
 using Newtonsoft.Json;
 

 public string xml2json(string xml)
 {
      XmlDocument doc = new XmlDocument();
      doc.LoadXml(xml);
      return Newtonsoft.Json.JsonConvert.SerializeXmlNode(doc);
 }

 public string json2xml(string json)
 {
      XmlDocument doc = Newtonsoft.Json.JsonConvert.DeserializeXmlNode(json);
      return doc.OuterXml;
 }



来了就留个评论吧! 1个评论




友情链接:Autohotkey中文帮助Autohotkey官网Autohotkey中文网联系作者免GooglePlay APK下载

 主题设计 • skyfrit.com  Thinkai's Blog | 保留所有权利

65 queries in 1.856 seconds |