且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将Json转换为Xml

更新时间:2023-02-14 10:38:08

在方法DeserializeXmlNode中,在第二个参数中指定根节点名称,如以下代码所示:

In method DeserializeXmlNode specify the root node name in second parameter as shown in below code:

XmlDocument doc =
  (XmlDocument)
     Newtonsoft.Json.JsonConvert.DeserializeXmlNode(json, "rootNodeName");
                                                   // second parameter

尽管可以给出json字符串,但给出确切答案很容易.

Although if you can give json string then it would be easy to give exact answer.

参考链接:将JSON转换为XML