1.第一种
<!-- 配置gson -->
<dependency>
<groupId></groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
Map<String, Object> map = null;
String jsonString = (uploadBaseEntity);
Gson gson = new Gson();
map = new HashMap<>();
map = (jsonString, ());
2.第二种
/**
* 对象转化为Map
*
* @param obj
* @return
* @throws Exception
*/
public static Map<String, String> objectToMap01(Object obj) throws Exception {
if (obj == null) {
return null;
}
Map<String, String> map = new HashMap<String, String>();
Field[] declaredFields = ().getDeclaredFields();
for (Field field : declaredFields) {
(true);
((), (String) (obj));
}
return map;
}