title: Jackson JSON gives exception on collection of nested class
body: <p>Jackson JSON has no problem serializing/deserializing this class:</p>
  
  <pre><code>public class MyClass {
     public class Nested {
        public String string;
        public Nested() {}
     }
     public Nested nestedVar;
  }
  </code></pre>
  
  <p>but on this one:</p>
  
  <pre><code>public class MyClass {
     class Nested {
        public String string;
        public Nested() {}
     }
     public Nested nestedVar;
     public List&lt;Nested&gt; nestedList;
  }
  </code></pre>
  
  <p>I get this exception when deserializing:</p>
  
  <blockquote>
    <p>com.fasterxml.jackson.databind.JsonMappingException: No suitable constructor found for type [simple type, class test.MyClass$Nested]: can not instantiate from JSON object (missing default constructor or creator, or perhaps need to add/enable type information?)
     at [Source: java.io.StringReader@26653222; line: 1, column: 48] (through reference chain: test.MyClass["nestedList"]->java.util.ArrayList[0])</p>
  </blockquote>
  
  <p>In the first case, Jackson has no problem dealing with an instance of a nested class, but not in the second case.</p>
  
  <p>Must I write a custom deserializer?</p>
  
  <p>Test code (Jackson 2.6.3):</p>
  
  <pre><code>import com.fasterxml.jackson.databind.ObjectMapper;
  import java.io.IOException;
  import java.io.StringReader;
  import java.io.StringWriter;
  import java.util.ArrayList;
  import java.util.List;
  
  public class ATest {
  
     public static void main(String[] args) throws IOException {
  
        ObjectMapper mapper = new ObjectMapper();
  
        StringWriter sw = new StringWriter();
  
        MyClass myClass = new MyClass();
  
        MyClass.Nested nestedVar = myClass.new Nested();
  
        List&lt;MyClass.Nested&gt; nestedList = new ArrayList&lt;&gt;();
  
        nestedList.add(nestedVar);
  
        myClass.nestedList =nestedList;
  
        myClass.nestedVar = nestedVar;
  
        mapper.writeValue(sw, myClass);
  
        System.out.println(sw.toString());
  
        StringReader sr = new StringReader(sw.toString());
  
        MyClass z = mapper.readValue(sr, MyClass.class);
  }
  </code></pre>
  
  <p>}</p>