title: How to build JSON array of different objects using Jackson?
body: <p>I'm building an android app that saves info on incoming/outgoing calls in a <code>CallLog</code> class, incoming/outgoing SMSes in an <code>SmsLog</code> class, and bytes sent/received via a <code>DataLog</code> class. I made them all implement a <code>JsonLog</code> interface so I can create a single <code>ArrayList</code> of <code>JsonLog</code>s, hoping that it will be easily convertible to a JSON array of different objects via Jackson.</p>
  
  <p>However, I kept getting this error whenever I'm deserializing the JSON file:</p>
  
  <pre><code>com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance
  of com.project.pojos.JsonLog, problem: abstract types either need to be mapped
  to concrete types, have custom deserializer, or be instantiated with additional
  type information
  </code></pre>
  
  <p>How can I solve this? All <code>JsonLog</code> classes have a string attribute <code>type</code>, which is either <code>in_call</code> or <code>out_call</code> for <code>CallLog</code>s, <code>in_sms</code> or <code>out_sms</code> for <code>SmsLog</code>s, and <code>data</code> for <code>DataLog</code>.</p>