0
我怎樣才能返回像{「項目」:「[」{「」:「」},{「」:「」,...「]」}形式的Spring MVC3.0的json對象列表?請對此有所幫助...如何從springMVC中返回JSON對象的列表?
我怎樣才能返回像{「項目」:「[」{「」:「」},{「」:「」,...「]」}形式的Spring MVC3.0的json對象列表?請對此有所幫助...如何從springMVC中返回JSON對象的列表?
@RequestMapping(value="/list", method=RequestMethod.GET)//, headers=ACCEPT_JSON)
@ResponseBody
public List<User> userList() {
LOG.info("get list of Users");
List<User> users = new ArrayList<User>();
users.add(new User("user1", "pass1", "name1", Boolean.TRUE));
users.add(new User("user2", "pass2", "name2", Boolean.TRUE));
users.add(new User("user3", "pass3", "name3", Boolean.TRUE));
return users;
}