我正在使用 Visual Studio C# 中的 asmx Web 服务。示例代码
WebRequest request = WebRequest.Create(WholeURL);
request.ContentType = "application/json; charset=utf-8";
request.Method = "POST";
request.ContentLength = postData.Length;
using (StreamWriter requester = new StreamWriter(request.GetRequestStream()))
{
requester.Write(postData);
requester.Close();
}
//Get the response
WebResponse response = request.GetResponse();
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader(dataStream);
// Read the content.ok
string responseFromServer = reader.ReadToEnd();
如何从 json 响应中删除 d
我的json响应是:{“d”:-1}我只需要-1。
谢谢