目录

hymn

忽有故人心头过,回首山河已是秋。

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}

标题:com.alibaba.fastjson把JSONObject转换为Map对象
作者:hymn
地址:https://dxyhymn.com/articles/2020/07/02/1593662454666.html