com.alibaba.fastjson把JSONObject转换为Map<String, Object>对象

 

 

JSONObject obj = new JSONObject();
{
obj.put("key1", "value1");
obj.put("key2", "value2");
obj.put("key3", "value3");
}
Map<String, String> params = JSONObject.parseObject(obj.toJSONString(), new TypeReference<Map<String, Object>>(){});
System.out.println(params);

//输出:{key3=value3, key2=value2, key1=value1}

posted @ 2018-08-02 10:57  rock_turf  阅读(4432)  评论(0编辑  收藏  举报