title: Exception- java.util.LinkedHashMap cannot be cast to custom object while converting a JSON List to Java objects
body: <p>I am using Facade pattern to implement JSON conversion. I have POJO classes corresponding to multiple JSON structures. I have facade classes corresponding to each POJO class. There is an AbstractFacade which has the implementation for converting the JSON entries to Java objects.</p>
  
  <p>So, here is an example :</p>
  
  <p>books.json</p>
  
  <pre><code>     [
        {
          category : "self-help",
          count :268         
         },
         {
          category : "fiction",
          count :268         
          }  
      ]
  </code></pre>
  
  <p>Book.java</p>
  
  <pre><code> public class Book {
  
            private String category;
            private int count;
  
            //getters and setters
   }
  </code></pre>
  
  <p>BookFacade.java </p>
  
  <pre><code>public class BookFacade extends AbstractFacade&lt;Book&gt; {
      public BookFacade() {
          super(Book.class);
          // TODO Auto-generated constructor stub
      }
  
  @Override
  public ArrayList&lt;Book&gt; readFileOfObjectList(String filePath){
      try {
          return super.readFileOfObjectList(filePath);
      } catch (JsonParseException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          return null;
  
  
      } catch (JsonMappingException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          return null;
  
  
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
          return null;
  
      }
    }     
  }
  </code></pre>
  
  <p>AbstractFacade.java</p>
  
  <pre><code>public class AbstractFacade&lt;T&gt; implements JSONFileUtil{
  
  private  Class&lt;T&gt; entityClass;
  
  public Class&lt;T&gt; getEntityClass() {
      return entityClass;
  }
  
  public void setEntityClass(Class&lt;T&gt; entityClass) {
      this.entityClass = entityClass;
  }
  
  public AbstractFacade(Class&lt;T&gt; entityClass) {
      super();
      this.entityClass = entityClass;
  }
  
  class ListT extends ArrayList&lt;T&gt;{
  
  }
  
  @Override
  public ListT readFileOfObjectList(String fileName) throws JsonParseException, JsonMappingException, IOException {
      // TODO Auto-generated method stub
  
      ObjectMapper mapper = new ObjectMapper();
      ListT list=mapper.readValue(new File(fileName), new TypeReference&lt;ListT&gt;(){});
      System.out.println("In abstract facade:"+list.get(0).getClass().getName());
      return list;
  }
  
  
  
  @Override
  public void writeFile(String fileName, Object data) throws IOException {
      // TODO Auto-generated method stub
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>So, I create an object of BookFacade in my main program and calls the method <code>readFileOfObjectList</code>. I get an ArrayList, but the objects within it are of type LinkedHashMap. I have checked many answers in StackOverflow. But none of them works for me. Could you please help?</p>