所依赖jar包
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.73</version>
</dependency>
json转对象:
Stutent identityApp =
JSONObject.parseObject(JSON.toJSONString(response.getDataObject()),Stutent.class);
Josn转List 所转的对象Date属性存在set方法,就可以正常转换
JSONArray jsonArray = new JSONArray();
jsonArray = JSONObject.parseArray(JSONObject.toJSONString(response.getDataObject()));
List<Stutent> result = jsonArray.toJavaList(Stutent.class);
Json转Set
List<String> Json = JSONArray.toList(JSONArray.fromObject(response.getDataObject()));
|