java对象 json对象 互转jar包
<dependency>
<groupId>net.sf.json-lib</groupId><artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
//字符串转json
JSONObject jsonObject = new JSONObject().fromObject("String");
//json转java对象
Proposal proposal = new JSONObject().toBean(jsonObject, Proposal.class)
//java对象转JSON
JSONObject object =JSONObject.fromObject(user);