There is a cycle in the hierarchy!

jonde_ 2010-07-18 01:23:55
用json-lib将list对象转成json串时提示"There is a cycle in the hierarchy!"
按照网上的解决方法加JsonConfg配置

JsonConfig config = new JsonConfig();
config.setJavaPropertyFilter(new PropertyFilter(){
public boolean apply(Object arg0, String arg1, Object arg2) {
if(arg1.equals("children")||arg1.equals("parent")){
return true;
}else{
return false;
}
}

--但结果还是一样的
实体类Module中有:
private Module parent;
private Set<Module> children = new HashSet<Module>(0);
...全文
209 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
liujie_24 2012-05-31
  • 打赏
  • 举报
回复
是问题总有解决方案的
雕虫大计 2010-07-20
  • 打赏
  • 举报
回复
json-lib不能解决这种有嵌套关系的对象吧。
tangyuanzhou 2010-07-20
  • 打赏
  • 举报
回复
唐元舟 非常好,加分
android好书系列,我目前找了两本,先贡献给大家。以后如果有好的资源,再上传和大家分享。 本资源是第一本。 这是一本学习android的好书,我浏览了,是老外著的,高清晰的pdf。为了方便大家学习android,我将本书所附的源码一块打包了。方便了不少,如果觉得好就顶一下吧,大家共同进步。 另外一本pro android 的下载地址: http://download.csdn.net/source/3139707 本书的目录结构如下: Chapter 1: The Big Picture Challenges of Smartphone Programming What Androids Are Made Of Stuff at Your Disposal ■Chapter 2: Projects and Targets Pieces and Parts Creating a Project Project Structure Root Contents The Sweat Off Your Brow And Now, the Rest of the Story What You Get Out of It Inside the Manifest In the Beginning, There Was the Root, And It Was Good Permissions, Instrumentations, and Applications (Oh My!) Your Application Does Something, Right? Achieving the Minimum Version=Control Emulators and Targets Virtually There Aiming at a Target ■Chapter 3: Creating a Skeleton Application Begin at the Beginning Dissecting the Activity Building and Running the Activity ■Chapter 4: Using XML-Based Layouts What Is an XML-Based Layout? Why Use XML-Based Layouts? OK, So What Does It Look Like? What’s with the @ Signs? And How Do We Attach These to the Java? The Rest of the Story ■Chapter 5: Employing Basic Widgets Assigning Labels Button, Button, Who’s Got the Button? Fleeting Images Fields of Green Or Other Colors Just Another Box to Check Turn the Radio Up It’s Quite a View Useful Properties Useful Methods Colors ■Chapter 6: Working with Containers Thinking Linearly LinearLayout Concepts and Properties LinearLayout Example All Things Are Relative RelativeLayout Concepts and Properties RelativeLayout Example Tabula Rasa TableLayout Concepts and Properties TableLayout Example Scrollwork ■Chapter 7: Using Selection Widgets Adapting to the Circumstances Lists of Naughty and Nice Spin Control Grid Your Lions (or Something Like That) Fields: Now with 35% Less Typing! Galleries, Give or Take the Art ■Chapter 8: Getting Fancy with Lists Getting to First Base A Dynamic Presentation Better Stronger Faster Using

67,514

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧