title: How to instruct Jackson to serialize a field inside an Object instead of the Object it self?
body: <p>I have an <code>Item</code> class. There's an <code>itemType</code> field inside of that class which is of type ItemType.</p>
  
  <p>roughly, something like this.</p>
  
  <pre><code>class Item
  {
     int id;
     ItemType itemType;
  }
  
  class ItemType
  {
     String name;
     int somethingElse;
  }
  </code></pre>
  
  <p>When I am serializing an object of type <code>Item</code> using Jackson <code>ObjectMapper</code>, it serializes the object <code>ItemType</code> as a sub-object. Which is expected, but not what I want.</p>
  
  <pre><code>{
    "id": 4,  
    "itemType": {
      "name": "Coupon",
      "somethingElse": 1
    }
  }
  </code></pre>
  
  <p>What I would like to do is to show the <code>itemType</code>'s <code>name</code> field instead when serialized. </p>
  
  <p>Something like below.</p>
  
  <pre><code>{
    "id": 4,  
    "itemType": "Coupon"
  }
  </code></pre>
  
  <p>Is there anyway to instruct Jackson to do so?</p>