List<Map<String,Object>>(=) is converted to JsonArray and displayed on the page

Putting List<Map<String,Object>> directly in modelAndView in spring mvc and displaying it in a loop on the page will have problems, because it is not json, and the value inside is like this [{addTime='2017-05-12 ',name='Wang Daxia'}], which needs to be converted in the background and the page is parsed.

The background is as follows:

JSONArray cards = JSONArray.fromObject(list);//The package is the net.sf package
modelAndView.addObject("list",cards);

page:

var jsonArray = JSON.parse('${list}');
for(var i in jsonArray){
      jsonArray[i].name;
      ....
}

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326572329&siteId=291194637