var json = JsonConvert.SerializeObject(obj); StringContent theContent = new StringContent(json, Encoding.UTF8, "application/json"); var r = client.PostAsync(url, theContent).Result.Content.ReadAsStringAsync().Result; 有简单一点的方法 client.PostAsJson…
一.Httpclient发送json请求 public String RequestJsonPost(String url){ String strresponse = null; try{ HttpClient hc = new DefaultHttpClient(); HttpPost hp = new HttpPost(url); JSONObject jsonParam = new JSONObject(); jsonPara…