在我的后端,我使用了一个返回以下内容的web服务:
<!-- this is the info of the user --> \r\n<User>\r\n<Name>Jhon Doe</Name>\r\n<Identification>10538181</Identification>\r\n<Email>JhonDoe@gmail.com</Email></User> 我想提取包含在以下标记中的文本:<Name> <Identification> <Email>由于我是c#新手,所以我想知道哪种方法是实现它的最佳方法
这是我想要的输出:
输出:
{
"Name":"Jhon Doe",
"Identification":10538181,
"Email":"JhonDoe@gmail.com",
}怎么才能做到呢?
发布于 2020-11-06 22:48:06
使用以下命令:
string xml = "YOUR INPUT";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
string json = JsonConvert.SerializeXmlNode(doc);https://stackoverflow.com/questions/64716655
复制相似问题