将JSONObject转换为地图 [英] Convert JSONObject to Map
本文介绍了将JSONObject转换为地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
JSONObject
,其中包含一些属性,我想转换成一个 Map< String,Object>
/ p> 有没有可以从json.org或 ObjectMapper
使用的东西?
解决方案
使用Jackson( http://jackson.codehaus.org/)从 http://json.org/
的HashMap<字符串,对象> result =
new ObjectMapper()。readValue(< JSON_OBJECT>,HashMap.class);
I have a JSONObject
with some attributes that I want to convert into a Map<String, Object>
Is there something that I can use from the json.org or ObjectMapper
?
解决方案
use Jackson(http://jackson.codehaus.org/) from http://json.org/
HashMap<String,Object> result =
new ObjectMapper().readValue(<JSON_OBJECT>, HashMap.class);
这篇关于将JSONObject转换为地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文