title: How can I return only several Json fields of an inner object with Jackson
body: <p>I'm using Jackson + spring RestControlles</p>
  
  <p>Lets say I have 3 classes </p>
  
  <pre><code>class Card {
     String id;
     String pan;
     String holder;
     String expiry;
  }
  
  class CardProfile {
     String id;
     Card card;
     ...
  }
  
  class Recipient {
     String name;
     Card card;
     ...
  }
  </code></pre>
  
  <p>So when I serialize a CardProfile object I want all fields of object card to be percent in result json. </p>
  
  <p>But in case Recipient object , Json has to have only part of object card(For example : pan, holder) . 
  Is there a way to present Card object in json with different set of fields?</p>
  
  <p>Use of annotations like @JsonIgnore will remove fields from both cases. </p>
  
  <p>Thanks.</p>