用 HttpClient 发送 POST 请求并提交 JSON 数据的核心是:创建复用的 HttpClient 实例、序列化对象为 UTF-8 编码的 application/json 格式 StringContent、调用 PostAsync 并检查 IsSuccessStatusCode。
用 HttpClient 发送 POST 请求并提交 JSON 数据,是 C# 中最常用、最推荐的方式。核心就三点:

先用 System.Text.Json(.NET Core 3.0+ 推荐)或 Newtonsoft.Json 把对象转成 JSON 字符串,再包装成 StringContent:
MediaType 为 "application/json"
Encoding.UTF8,避免中文乱码
示例:
var user = new { Name = "张三", Age = 25 };
var json = JsonSerializer.Serialize(user);
var content = new StringContent(json, Encoding.UTF8, "application/json");HttpClient 应该复用(全局单例或注入),不要每次 new。发送时调用 PostAsync:
http:// 或 https://)await response.Content.ReadAsStringAsync() 读取结果response.IsSuccessStatusCode 判断是否成功示例:
using var client = new HttpClient();
var response = await client.PostAsync("https://api.example.com/users", content);
if (response.IsSuccessStatusCode)
{
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}实际开发中容易卡在这几个地方:
client.DefaultRequestHeaders.Authorization 添加 Tokennew HttpClient(new HttpClientHandler(), false) { Timeout = TimeSpan.FromSeconds(30) } 设置HttpClientHandler.ServerCertificateCustomValidationCallback
把上面整合起来,一个最小可用片段:
var data = new { Title = "测试文章", Content = "Hello World" };
var json = JsonSerializer.Serialize(data);
var content = new StringContent(json, Encoding.UTF8, "application/json");
using var client = new HttpClient();
var res = await client.PostAsync("https://www./link/dc076eb055ef5f8a60a41b6195e9f329", content);
Console.WriteLine(await res.Content.ReadAsStringAsync());
基本上就这些。不复杂但容易忽略编码、复用和状态判断 —— 补上这三点,99% 的 POST 提交都稳了。