【发布时间】:2014-07-22 07:22:09
【问题描述】:
我的问题是,当我浏览到服务 URL 时,我看到“键值”对,但我没有看到数组或对象的名称,我需要该名称,因为我想将该服务用于 android。
看起来像这样:
我的代码如下所示:
1.在 ValueController 我有方法:
[AcceptVerbs("GET", "POST")]
public List<BuzzMonitor.Web.Message> Search(string text, DateTime dateFrom, DateTime dateTo, [ModelBinder]List<int> themeIds, [ModelBinder]List<int> sourceIds)
{
MessageHandler mh = new MessageHandler();
List<BuzzMonitor.Web.Message> messages = null;
messages = mh.Search(text,dateFrom,dateTo,themeIds,sourceIds);
return messages;
}
2。在 Global.asax 我添加了:
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
当我没有看到完整的 JSON 并且只看到键:值对时,是否有人知道缺少什么?谢谢你的帮助!
【问题讨论】:
标签: c# android asp.net json asp.net-web-api