如何通过后台代码获取map类型如下所示的数据:
data = {
"ubuntu":{"pkg_type":"deb","boot_type":"upstart"},"centOS":{"pkg_type":"rpm","boot_type":"systemd"}
};
后台json返回一个Map类型的数据:
public Map<String,Object> selectLdjqpz(){
Map<String,Object> result = new LinkedHashMap<String,Object>();
Map<String,String> map2 = new HashMap<String,String>();
map2.put("pkg_type","rpm");
map2.put("boot_type","systemd");
result.put("centOS",map2);Map<String,String> map1 = new HashMap<String,String>();
map1.put("pkg_type","deb");
map1.put("boot_type","upstart");
result.put("ubuntu",map1);
return result;
}
在后台打印的是一个:{centOS={boot_type=systemd, pkg_type=rpm}, ubuntu={boot_type=upstart, pkg_type=deb}}