其他分享
首页 > 其他分享> > com.alibaba.fastjson把JSONObject转换为Map对象

com.alibaba.fastjson把JSONObject转换为Map对象

作者:互联网

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, String>>(){});
System.out.println(params);

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

标签:fastjson,Map,obj,key3,JSONObject,key1,key2,put
来源: https://blog.csdn.net/qq_33580178/article/details/88657360