我试图创建一个http post,它返回一个带有2个属性的json对象。
详情如下:
使用包含字符串的表单编码数据发送到http://text-processing.com/api/sentiment/。返回具有两个属性的json对象响应;labe和negative。
我想在C_做这件事,这是我挣扎的地方。
谢谢你
最佳答案
您可以尝试使用这样的WebClient
。
WebClient webclient = new WebClient();
NameValueCollection postValues = new NameValueCollection();
postValues.Add("foo", "fooValue");
postValues.Add("bar", "barValue");
byte[] responseArray = webclient.UploadValues(*url*, postValues);
string returnValue = Encoding.ASCII.GetString(responseArray);
MSDN page还有一个例子。
关于c# - 具有JSON对象的HTTP POST返回了C#,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6154031/