带有JSON对象的HTTP POST返回c#

use*_*101 2 c# json http http-post

我正在尝试创建一个HTTP Post,它返回一个带有2个属性的JSON对象.

详情如下:

使用包含字符串的表单编码数据的HTTP POST到http://text-processing.com/api/sentiment/.重新调整具有2个属性的JSON对象响应; 标签和负面.

我想在c#中这样做,这是我在努力的地方.

谢谢

Bal*_*a R 7

您可以尝试使用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);
Run Code Online (Sandbox Code Playgroud)

MSDN页面也有一个例子.