使用net.sf.json包提供的JSONObject.toBean方法时,日期转化错误解决办法
2016-08-22 17:02
871 查看
解决办法:
需要在toBean之前添加配置
源文:http://blog.csdn.net/rnzuozuo/article/details/21992137
需要在toBean之前添加配置
String[] dateFormats = new String[] {"yyyy-MM-dd HH:mm:ss"}; JSONUtils.getMorpherRegistry().registerMorpher(new DateMorpher(dateFormats)); Map<String, Class> classMap = new HashMap<String, Class>(); MemberPlayLogs memberPlayLogs = (MemberPlayLogs) JSONObject.toBean(jsonObject, MemberPlayLogs.class,classMap);
源文:http://blog.csdn.net/rnzuozuo/article/details/21992137
相关文章推荐
- JSONObject.toBean中日期格式数据转换失效的解决办法! .
- JSONObject.toBean中日期格式数据转换失效的解决办法!
- Myeclipes 使用json发生java.lang.NoClassDefFoundError: net/sf/json/JSONObject异常的解决办法
- 使用JSONObject.fromObject toBean方法 属性类型为 data Timestamp 的处理
- 使用json发生java.lang.NoClassDefFoundError: net/sf/json/JSONObject异常的解决办法
- 使用json发生java.lang.NoClassDefFoundError: net/sf/json/JSONObject异常的解决办法
- jsonobject.tobean date的解决办法
- 使用json发生java.lang.NoClassDefFoundError: net/sf/json/JSONObject异常的解决办法
- 错误: java.io.NotSerializableException: net.sf.json.JSONObject 的解决方法
- 使用json发生java.lang.NoClassDefFoundError: net/sf/json/JSONObject异常的解决办法
- VS2010 出现错误提示“Error Creating Control - Object reference not set to an instance of an objec” 的解决方法
- vs数据库访问出现Object reference not set to an instance of an object. 错误解决办法
- 获取form表单的值并转化为字符串、JSONArray或JSONObject的方法及form取不到值的解决办法
- MAC - 使用 brew 安装东西时出现 curl: (7) Failed connect to downloads.sf.net:443; Operation timed out 的解决办法
- iOS使用NSUserDefaults 存储数据报Attempt to set a non-property-list object as an NSUserDefaults value的错误解决
- VS2005 solution文件打开时弹出“object reference not set to an instance of an object”错误的解决方法
- net.sf.json.exception:Unquotted String错误,解决办法。
- 我遇到的Object reference not set to an instance of an object.错误的解决办法
- JSONException:java.lang.String cannot be converted to JSONObject解决办法
- 使用screen恢复会话时出现There is no screen to be resumed matching错误解决办法