如何通过后台代码获取map类型如下所示的数据:
2016-02-16 13:32
567 查看
如何通过后台代码获取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}}
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}}
相关文章推荐
- JAXWS 开发webService ,使用spring注入service类时,无法注入,报空指针
- 利用GetPrivateProfileString读取配置文件(.ini)
- JAVA环境变量的搭建
- C++之引用
- C++之引用
- C++之引用
- 160216编程日常
- JPA criteria 查询:类型安全与面向对象
- Spring使用Cache
- delphi中Message消息的使用方法
- Java描述贪心算法解决背包问题
- Spring Data JPA入门
- 使用QT实现右击菜单实例
- yii2 ActiveForm::begin的区分
- cast——java类型转换
- java基础-----2Java 发展简史
- 【C++基础之二十】可变参数的函数
- 使用anaconda本地安装python包的方法
- 使用anaconda本地安装python包的方法
- 2015年度总结--javaWeb