json数据如下:
{"8452d65c67":"小猪佩奇","8452d65c67":"小猪佩奇","8452d65c68":"小猪佩奇2"}
去重代码:
public JSONObject repeat(JSONObject json){
Map<String,Object> map = new HashMap<String,Object>();
Iterator<String> jsonIter = json.keys();
while(jsonIter.hasNext()){
String key = jsonIter.next();
String value = (String) json.get(key);
map.put(key,value);
}
return JSONObject.fromObject(map);
}