我有一个控制器函数,它返回一个列表数据类型,一旦发送回我的 jQuery,就会转换为 JSON。
我的问题(不是真正的问题)是数据返回没有字段名称,我希望它们具有字段名称。
我在这里找到了一些涉及配置杰克逊的帖子,但它似乎是一个全局设置。我只希望一些函数返回命名字段。
你能帮忙吗?谢谢
我的控制器功能
@RequestMapping(value = "/GetEvents", method = RequestMethod.GET, headers="Accept=*/*")
public @ResponseBody List<Session> getEvents(@RequestParam("description") String description) {
List<Session> temp = issuService.getEvents(description);
return temp;
}
按函数返回数据(在 firebug 中查看)
[[1149,"Thursday , 31 January 2013 @ 13:00 - 15:00",1,"2013-01-31"],[1150,"Wednesday, 06 February 2013 @ 13:00 - 15:00",1,"2013-02-06"],[1151,"Wednesday, 13 February 2013 @ 13:00 - 15:00",1,"2013-02-13"],[1152,"Monday , 18 February 2013 @ 13:00 - 15:00",1,"2013-02-18"],[1169,"Wednesday, 20 February 2013 @ 13:00 - 15:00",1,"2013-02-20"],[1170,"Monday , 25 February 2013 @ 13:00 - 15:00",1,"2013-02-25"],[1171,"Tuesday , 26 February 2013 @ 13:00 - 15:00",1,"2013-02-26"],[1172,"Wednesday, 27 February 2013 @ 13:00 - 15:00",1,"2013-02-27"],[1173,"Thursday , 28 February 2013 @ 13:00 - 15:00",1,"2013-02-28"],[1174,"Friday , 01 March 2013 @ 13:00 - 15:00",1,"2013-03-01"]]