How do I pass an object to HttpClient.PostAsync and serialize as a JSON body?
问题 I'm using System.Net.Http , I found several examples on the web. I managed to create this code for make a POST request: public static string POST(string resource, string token) { using (var client = new HttpClient()) { client.BaseAddress = new Uri(baseUri); client.DefaultRequestHeaders.Add("token", token); var content = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("", "") }); var result = client.PostAsync("", content).Result; string resultContent = result.Content