<分区>
如何将xml数据转换成JSON格式。我也想通过 SOAP 发送它。
你能举个例子吗?
标签 c# asp.net json soap-client
<分区>
如何将xml数据转换成JSON格式。我也想通过 SOAP 发送它。
你能举个例子吗?
最佳答案
您可以使用 JsonConvert 类进行转换。
这是代码
// To convert an XML node contained in string xml into a JSON string
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
string jsonText = JsonConvert.SerializeXmlNode(doc);
// To convert JSON text contained in string json into an XML node
XmlDocument doc = JsonConvert.DeserializeXmlNode(json);
以上代码来自这里How to convert JSON to XML or XML to JSON?
用于通过 soap 发送数据 Client to send SOAP request and received response
关于c# - 如何在 C# 中将字符串 xml 转换为 json 并在 C# 中通过 SOAP 发送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31635469/