private static List<Map<String,Object>> objectToMap(Object object,String type) throws IllegalAccessException { List<Map<String,Object>> list = new ArrayList<>(); Class<?> clazz = object.getClass(); for (Field field : clazz.getDeclaredFields()) { Map<String,Object> map = new HashMap<>(); field.setAccessible(true); String name = field.getName(); Object o = field.get(object); map.put("type",type); map.put("keyname",field.getName()); map.put("keyvalue",o); list.add(map); } return list; }