title: Jackson ignore property of object in list property
body: <p>One can ignore a property of a class using <code>@JsonIgnoreProperties</code>as a class level annotation. But let's say you have the following two classes;</p>
  
  <pre><code>class Client {
  
        @JsonIgnoreProperties ("owner")
        List&lt;Vehicle&gt; vehicles;
  }
  
  
  Class Vehicle {
  
        @JsonIgnoreProperties ("vehicles")
        Client owner;
  }
  </code></pre>
  
  <p>I thought this would work. But apparently The <code>JsonIgnoreProperties</code> doesn't work on the list. I imagine it checks <code>java.util.List</code> for property òwner`but it doesn't find it.</p>
  
  <p>What i want is a filter based on which object is retrieved first. If the <code>Vehicle</code> was retrieved first, show the owner but don't show the <code>vehicles</code> that Client has. And if the <code>Client</code>is retrieved first, show <code>vehicles</code> but don't show each <code>Vehicle</code>'s owner. This was too avoid the unending recursion.</p>
  
  <p>My question is how can i ignore the property <code>owner</code> in the objects of <code>Vehicle</code> in the list <code>vehicles</code> in <code>Client</code>?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Using @Kushan answer.</p>
  
  <pre><code>@JsonIgnoreProperties ("owner")
  Class Vehicle {
  
     Client owner;
  </code></pre>
  
  <p>}</p>
  
  <p>This will always ignore the <code>owner</code> information. What I'm intending to get is if I have <code>Client</code>object and i'm getting it's <code>vehicles</code>, I don't need the resulting <code>owner</code> information of the <code>Vehicle</code>since i already have the <code>Client</code>object. But if i have a <code>Vehicle</code>object to begin with, I will need it's <code>owner</code> property excluding all the <code>vehicles</code> that <code>Client</code> has.</p>