Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/300.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在c#中将字符串xml转换为json并在c#中通过SOAP发送#_C#_Asp.net_Json_Soap Client - Fatal编程技术网

如何在c#中将字符串xml转换为json并在c#中通过SOAP发送#

如何在c#中将字符串xml转换为json并在c#中通过SOAP发送#,c#,asp.net,json,soap-client,C#,Asp.net,Json,Soap Client,如何将xml数据转换为JSON格式。我也想用肥皂把它送过去 您能提供一些示例吗?您可以使用JsonConvert类进行转换 这是密码 // To convert an XML node contained in string xml into a JSON string XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); string jsonText = JsonConvert.SerializeXmlN

如何将xml数据转换为JSON格式。我也想用肥皂把它送过去


您能提供一些示例吗?

您可以使用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);
上面的代码来自这里


通过soap发送数据

对我来说有两个不同的问题,一个是关于从XML到JSON格式的转换,另一个是关于soap使用的C#库。如果你能集中你的问题,展示你已经尝试过的东西,那就更好了