jsonobject.tobean date的解决办法

前端之家收集整理的这篇文章主要介绍了jsonobject.tobean date的解决办法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
if(zhongdJsonArr!=null&&zhongdJsonArr.size()>0){
	for (int i = 0; i < zhongdJsonArr.size(); i++) {
		entry = zhongdJsonArr.getJSONObject(i);
		//控制java.util.date
		String[] dateFormats = new String[]{"yyyy-MM-dd HH:mm:ss"};
		JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(dateFormats));
							
							
		KmGmZhongduaninfo info = (KmGmZhongduaninfo)JSONObject.toBean(entry,KmGmZhongduaninfo.class);

		zhongduanService.addOrModifyOrDelZhongduan(info,Integer.parseInt(syncType));
	}

	jsonObject.put("resCode",200);
	jsonObject.put("resDesc","处理成功!");

}

关键代码

//控制java.util.date
String[] dateFormats = new String[]{"yyyy-MM-dd HH:mm:ss"};

JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(dateFormats));




感谢http://www.iteye.com/problems/9822提供.

猜你在找的Json相关文章