使用JSONArray.fromObject(priceList).toString() 来格式化一个List<Object>,自定义对象的list时
提示警告
2009-11-18 15:42:08 net.sf.json.JSONObject _fromBean
警告: Property 'pricesByLid' has no read method. SKIPPED
2009-11-18 15:42:08 net.sf.json.JSONObject _fromBean
警告: Property 'pricesJosnByLid' has no read method. SKIPPED
2009-11-18 15:42:08 net.sf.json.JSONObject _fromBean
警告: Property 'pricesByLid' has no read method. SKIPPED
不停的警告!!
原因发现:
调用json的类中所有的方法如果命名的时候只要以getXXX就会出现这个不能读。
目前只有的解决办法是:
改命名方式,改成list或其他
本文探讨了使用JSONArray.fromObject进行List<Object>格式化时遇到的警告问题,特别是自定义对象list时出现的属性无法读取警告,并提供了解决方案。

被折叠的 条评论
为什么被折叠?



