JSONObject.fromObject() 需要引入的包
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>
2.4
</version>
</dependency>
JSONObject.fromObject(obj) 報錯
自動導包一般會導入這個
import com.alibaba.fastjson.JSONObject;
其實需要的是這個
import net.sf.json.JSONObject;
java object 序列化成實體類
String busType = params.get("busType") == null ? "" : params.get("busType").toString();
JSONObject objJson = JSONObject.fromObject(params.get("data"));
MettingDocLibsEntity docData = (MettingDocLibsEntity) JSONObject.toBean(objJson, MettingDocLibsEntity.class);
