Java-list集合转成前端需要的json格式
[
{
"id": "111",
"name": "长沙",
"criCount":8,
"sesCount":4
},
{
"id": "222",
"name": "湘潭",
"criCount":10,
"sesCount":5
}
]
[
{
"长沙": 8,
"湘潭":10
},
{
"长沙": 4,
"湘潭":5
}
]
package com.nanjing.gulimall.zhouyimo;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.M