处理一个list集合463条数据
用fastjson代码片如下:
long a = System.currentTimeMillis();
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(httpResult);
com.alibaba.fastjson.JSONArray json = jsonObject.getJSONArray("returnValue");
List<AdvertiserDto> lists = json.toJavaList(AdvertiserDto.class)
System.out.println("用时:"System.currentTimeMillis()-a)
用时:7
用fastjson代码片如下:
long a = System.currentTimeMillis();
JSONObject resultJsonObject = JSONObject.fromObject(httpResult);
JSONArray results = resultJsonObject.getJSONArray("returnValue");
List<AdvertiserDto> lists = JSONArray.toList(results, AdvertiserDto.class);
System.out.println(System.currentTimeMillis()-a)
用时:1349
两个方式处理数据的速度天壤之别
fastjson比json-lib快10倍不止