private Map<String, Object> object2Map(Object object){ JSONObject jsonObject = (JSONObject) JSON.toJSON(object); Set<Entry<String,Object>> entrySet = jsonObject.entrySet(); Map<String, Object> map=new HashMap<String,Object>(); for (Entry<String, Object> entry : entrySet) { map.put(entry.getKey(), entry.getValue()); } return map; }