Workaround for Jackson infinite recursion in third party classes
<p>Is there any way of programatically telling jackson to ignore a property? For instance, by name.</p>

<p>My problem is that I'm serializing third party objects, some of which have parent/child cyclic dependencies that cause</p>

<pre><code>com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError)
</code></pre>

<p>Because I can't modify the code, <a href="https://stackoverflow.com/questions/3325387/infinite-recursion-with-jackson-json-and-hibernate-jpa-issue">the usual ways of breaking cyclic dependencies</a> don't work for me.</p>

<p>I'm using an <code>ObjectMapper</code> and <code>ObjectWriter</code>:</p>

<pre><code>ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.setVisibility(new VisibilityChecker.Std(JsonAutoDetect.Visibility.ANY));
writer = mapper.writerWithDefaultPrettyPrinter();
writer.writeValueAsString(object);
</code></pre>

<p>And I know they're highly customizable, as with the serialization inclusion and visibility that I have in the snippet, but I can't find they way of achieving something like</p>

<pre><code>mapper.ignoreProperty("parent");
</code></pre>