title: How to identify the missing type id in Jackson error?
body: <p>I am using Jackson to write JSON to a text file, the JSON represents 2 classes inherited from an abstract class but the error also occurs irrespective of whether both or either/or classes are used. The JSON appears to be written correctly but on reading, I get the following error:</p>
  
  <pre><code>Missing type id when trying to resolve subtype of [simple type, class model.BaseContact]: missing type id property 'type'
       at [Source: (File); line: 52, column: 1]
  json as follows:
      {
     "allContacts" : [ {
       "type" : "personal",
      "addressCity" : "Hamilton",
      "addressNum" : "199",
     "addressPOBox" : null,
      "addressPostCode" : null,
      "addressStreet" : "River Rd",
      "addressSuburb" : null,
      "email" : null,
      "latitude" : null,
      "longitude" : null,
      "name" : "silly simon",
      "notes" : null,
      "phoneNumber" : "09754321",
      "photoBytes" : null,
      "photoURL" : null
    }, {
      "type" : "personal",
      "addressCity" : "Auckland",
      "addressNum" : "482",
      "addressPOBox" : null,
      "addressPostCode" : null,
      "addressStreet" : "Smith Rd",
      "addressSuburb" : null,
      "email" : null,
      "latitude" : null,
      "longitude" : null,
      "name" : "paul smith",
      "notes" : null,
      "phoneNumber" : "0544555",
      "photoBytes" : null,
      "photoURL" : null
    }, {
      "type" : "personal",
      "addressCity" : "Appleby",
      "addressNum" : "123",
      "addressPOBox" : null,
      "addressPostCode" : null,
      "addressStreet" : "Apple rd",
      "addressSuburb" : null,
      "email" : null,
      "latitude" : null,
      "name" : "Steve Jobbs",
      "notes" : null,
      "phoneNumber" : "08004343",
      "photoBytes" : null,
      "photoURL" : null
    } ],
    "size" : 3
  }
  </code></pre>
  
  <p>The error message refers to line 52 column 1, assuming the debugger starts at line 1 that would be the line after the final curly brace.</p>
  
  <p>The <code>BaseContact</code> class header is as follows:</p>
  
  <pre><code>import com.fasterxml.jackson.annotation.JsonSubTypes;
  import com.fasterxml.jackson.annotation.JsonTypeInfo;
  
  @JsonTypeInfo(
          use=JsonTypeInfo.Id.NAME,
          include=JsonTypeInfo.As.PROPERTY,
          property="type")
  @JsonSubTypes({
          @JsonSubTypes.Type(value=PersonContact.class, name= "personal"),
          @JsonSubTypes.Type(value= BusinessContact.class, name="business")
  })
  
  public  abstract class BaseContact {
  
  public String name;
  public String addressNum;
  public String addressStreet;
  public String addressSuburb;
  public String addressCity;
  public String addressPOBox;
  public String addressPostCode;
  public Double latitude;
  public Double longitude;
  
  public String photoURL;
  public String photoBytes;
  public String phoneNumber;
  public String email;
  
  public String notes;
  
  public BaseContact() {
      //DEFAULT CONSTRUCTOR
  
  }
  
  
      public BaseContact( String name, String addressNum, String addressStreet, 
      String addressCity, String phoneNumber) {
  
      this.name = name;
      this.addressNum = addressNum;
      this.addressStreet = addressStreet;
      this.addressCity = addressCity;
      this.phoneNumber = phoneNumber;
  }
  </code></pre>
  
  <p>The calling function is as follows:</p>
  
  <pre><code> public BusinessService readAllData(String fn) {
    ArrayList&lt;BaseContact&gt; abl = new ArrayList&lt;BaseContact&gt;();
              try {
                  abl = new ObjectMapper().readerFor(BaseContact.class).readValue(new File(fn));
                  Log.d("qq","abl"+ abl);
              } catch (IOException e) {
                  Log.d("qq", "failed reading " + e.getMessage().toString());
                  e.printStackTrace();
              }
  
  
               BusinessService b = new BusinessService();
              return b;
      }
  </code></pre>
  
  <p>The <code>BusinessContact</code> class ( inherits from abstract <code>BaseContact</code>) is as follows:</p>
  
  <pre><code>package model;
  
  import com.fasterxml.jackson.annotation.JsonTypeName;
  import com.fasterxml.jackson.annotation.JsonTypeInfo;
  @JsonTypeInfo(
      use=JsonTypeInfo.Id.NAME,
      include=JsonTypeInfo.As.PROPERTY,
      property="type")
  @JsonTypeName("type")
  public class BusinessContact extends BaseContact {
  public String companyName;
  public String websiteURL;
  public String businessHours;
  //def constructor
  public BusinessContact(){
  };
  public BusinessContact(String name,  String addressNum, String addressStreet, 
  String addressCity, String phoneNumber, String companyName, String websiteURL, String businessHours) {
      super(name, addressNum, addressStreet, addressCity, phoneNumber);
      this.companyName = companyName;
      this.websiteURL = websiteURL;
      this.businessHours = businessHours;
  }
  
  //Getters and setters
  public String getCompanyName() {
      return companyName;
  }
  public void setCompanyName(String companyName) {
      this.companyName = companyName;
  }
  public String getWebsiteURL() {
      return websiteURL;
  }
  public void setWebsiteURL(String websiteURL) {
      this.websiteURL = websiteURL;
  }
  public String getBusinessHours() {
      return businessHours;
  }
  public void setBusinessHours(String businessHours) {
      this.businessHours = businessHours;
  }
  public String visitWebsite(int i ){
      //get website, construct intent
      return"url intent";
  }
  public Boolean isOpen(int i ){
      //do math for day and time and return true if open
      return true;
  }
  @Override
  public String toString() {
      String output= this.getClass() + "name: "+ this.name + " " + "company"+ this.companyName + "Hours "+ this.businessHours + "Website "+ this.websiteURL+ " address: " + this.addressNum+ " , " + this.addressStreet + " , " + this.addressSuburb+ "," +
              this.addressCity +" , CODE " + this.addressPostCode + " PO BOX " + this.addressPOBox + "PH: " +  this.phoneNumber + "email: " + this.email + "notes: "+ this.notes ;
      return output ;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The <code>PersonContact</code> class ( inherits from abstract <code>BaseContact</code>):</p>
  
  <pre><code>package model;
  import com.fasterxml.jackson.annotation.JsonSubTypes;
  import com.fasterxml.jackson.annotation.JsonTypeInfo;
  import com.fasterxml.jackson.annotation.JsonTypeName;
  @JsonTypeInfo(
          use = JsonTypeInfo.Id.NAME,
          include = JsonTypeInfo.As.PROPERTY,
          property = "type")
  @JsonTypeName("type")
  public class PersonContact extends BaseContact {
     //constructor
      public PersonContact(String name, String addressNum, String addressStreet, String addressCity, String phoneNumber) {
          super(name, addressNum, addressStreet, addressCity, phoneNumber);
      }
      @Override
      public String toString() {
          String output = this.getClass() + "name: " + this.name + " " + " address: " + this.addressNum + " , " + this.addressStreet + " , " + this.addressSuburb + "," +
                  this.addressCity + " , CODE /n " + this.addressPostCode + " PO BOX " + this.addressPOBox + "PH: " + this.phoneNumber + "email: " + this.email + "notes: " + this.notes;
          return output;
      }
  }
  </code></pre>