title: How to resolve circular reference in JSON serializing?
body: <p>Help me, please, to store tree structure in JSON format. I got</p>
  
  <pre><code>ERROR 6444 --- [nio-8090-exec-1] o.a.c.c.C.[.[.[/].    [dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.StackOverflowError] with root cause
  
  java.lang.StackOverflowError: null
      at java.lang.Class.getGenericInterfaces(Class.java:912) ~[na:1.8.0_40]
      at com.fasterxml.jackson.databind.type.TypeFactory._doFindSuperInterfaceChain(TypeFactory.java:1260) ~[jackson-databind-2.6.6.jar:2.6.6]
      at com.fasterxml.jackson.databind.type.TypeFactory._findSuperInterfaceChain(TypeFactory.java:1254) ~[jackson-databind-2.6.6.jar:2.6.6]
      // more stacktrace here...
  </code></pre>
  
  <p>on the folowing code:</p>
  
  <pre><code>public class CustomASTNode implements ASTNode {
      private final CustomNode node; // simple property
      private final ASTNodeID id; // simple property
      @JsonBackReference
      private final ASTNode parent; // circular property!
      @JsonManagedReference
      private List&lt;ASTNode&gt; children = new ArrayList&lt;&gt;(); // circular property!
      // more code
  }
  
  public interface ASTNode extends Iterable&lt;ASTNode&gt; { // ?
      // more code
  }
  </code></pre>
  
  <p>I used <code>@JsonBackReference</code> and <code>@JsonManagedReference</code> annotations to deal with fields, but have no ideas how to resolve recursion in interface. Is it possible or maybe it is necessary to rewrite these snippet?</p>