fastJson转换为泛型类(List<T>)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_39338799/article/details/81944942

在处理json数据时,会遇到将json串转成javaBean的情况,这时候用fastJson的JSONObject.parseObject(text, clazz)方法很好用,不过转换为类似List<T> 、Map<Obj,Obj>、PageInfo<T>这类的Bean时怎么转呢?

以下List<T> 为例:

List<DemoDto> list = new ArrayList<DemoDto>();

ArrayList<DemoDto>  arraylist   =  (ArrayList<DemoDto>)JSONObject.parseObject( demoDtoJsonString , List.class);

猜你喜欢

转载自blog.csdn.net/qq_39338799/article/details/81944942
今日推荐