先将字符串转成JSONObject
JSONObject jsonObject = JSONObject.fromObject(gModeContentEnglish1.getModeContents());
在使用JSONObject的toBean()方法,这里需要强转一下
Community communitya = (Community)JSONObject.toBean(jsonObject, Community.class );
JSONObject.fromObject需要导入的jar包
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
</dependency>