Java-使用反射来处理对象,并构建新的JSON数据结构
[
{
"id": "111",
"name": "长沙",
"criCount":8,
"sesCount":4
},
{
"id": "222",
"name": "湘潭",
"criCount":10,
"sesCount":5
}
]
[
{
"level":"危急",
"长沙": 8,
"湘潭":10
},
{
"level":"严重",
"长沙": 4,
"湘潭":5
}
]
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gson.Gson;
public class Main {
public static void main(String[] args) {
// 原始数据
List<Map<