您的位置:首页 > 编程语言

如何通过后台代码获取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}}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: