嗨伙计们!
我的问题是我无法提取 api 发送的对象,尽管我在 API 或客户端中有对象的模式。我的代码
public async Task<ActionResult> Index()
{
HttpClient client = new HttpClient();
Uri baseAddress = new Uri("http://localhost:44237/");
client.BaseAddress = baseAddress;
HttpResponseMessage response = client.GetAsync("api/Front/Subm?IdSubmission=1xxx").Result;
try
{
if (response.IsSuccessStatusCode)
{
string Result = await response.Content.ReadAsStringAsync();
JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
Submission sub = JsonConvert.DeserializeObject<Submission>(Result);
return View(sub);
}
else
{
}
}
catch (Exception e)
{
}
}
结果中收到的结构是 在此处输入图像描述
但我的对象始终是: 在此处输入图像描述
感谢您的帮助 !!!!