Json数据去重解决

json数据如下:

{"8452d65c67":"小猪佩奇","8452d65c67":"小猪佩奇","8452d65c68":"小猪佩奇2"}

去重代码:

public JSONObject repeat(JSONObject json){
	   Map map = new HashMap();
	   Iterator jsonIter = json.keys();
	   while(jsonIter.hasNext()){
	       String key = jsonIter.next();
	       String value = (String) json.get(key);
	       map.put(key,value);
	   }
	   return JSONObject.fromObject(map);
}

 

你可能感兴趣的:(json,java,java,json,map)