title: Jackson infinite recursion when converting to json
body: <p>When trying to convert a custom object <code>Tag</code> which has the below structure to json, it gives me the following error: <code>java.lang.IllegalArgumentException: Infinite recursion</code> because of <code>getValueArray()</code> function</p>
  <pre><code>public class Tag {
      private String vr;
      @JsonProperty(&quot;Value&quot;)
      private JsonNode Value;
  
      //getters and setters
  
      public org.primefaces.model.TreeNode getValueArray() throws IOException
      {
          System.out.println(&quot;enter check&quot;);
          TreeNode root = new DefaultTreeNode();
          constructTree(Value, 1, root);
          return root;
      }
  }
  </code></pre>
  <p>I have a getter for <code>Value</code> that returns String instead of JsonNode (for specific reason), and I have this <code>getValueArray</code> that causes the problem, <code>Jackson</code> calls this function when converting to json instead of using <code>getValue</code> (I know that as <code>enter check</code> are printed to console), actually when I remove this function it works, for some reason it calls this function and uses the returned <code>TreeNode</code> in it's conversion, I thought the problem might be that it gets confused with <code>Jackson treeNode</code>, so I returned <code>org.primefaces.model.TreeNode</code> to let it recognizes that this is <code>primefaces TreeNode</code> not <code>Jackson TreeNode</code>, I don't even know why it calls this function, and how to fix this.</p>
  <p>the error said</p>
  <pre><code>java.lang.IllegalArgumentException: Infinite recursion (StackOverflowError) (through reference chain: org.primefaces.model.DefaultTreeNode[&quot;parent&quot;]-&gt;org.primefaces.model.DefaultTreeNode[&quot;children&quot;]-&gt;org.primefaces.model.TreeNodeChildren[0]-&gt;org.primefaces.model.DefaultTreeNode[&quot;parent&quot;]................. and so on
  </code></pre>