帮帮我,请接收一些 JSON 数组
如果我使用请求正文发送请求(由提琴手),如下所示:
[{"name":"Homerius", "tonumber":"155555", "fromnumber":"166666", "text":"&&??!"}, {"name":"Stone", "tonumber" :"9654999", "fromnumber":"999666", "text":"h9miii99!"}]
我怎样才能在控制器中接收它?
我尝试做这样的事情:
public HttpResponseMessage Post(JObject[] smspackage)
{
List<MySMS> smses = smspackage.ToList<MySMS>();
try
{
SMS_Repository.Add(smses);
return Request.CreateResponse<MySMS>(HttpStatusCode.Created, smses);
}
catch (Exception)
{
return Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, "error");
}
}
但它不起作用......
对不起,我的英语不好