title: Jackson: "(although at least one Creator exists): no String-argument constructor/factory method to deserialize"
body: <p>Altought the problem might sound simple, I'm facing this exception on a very simple bean as well:</p>
  <pre class="lang-java prettyprint-override"><code>@Data
  public class Foo {
    private List&lt;Error&gt; errors;
  
    @Data
    public static class Error {
      private int code;
      private String message;
    }
  }
  </code></pre>
  <p>The JSON:</p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;errors&quot;: [
      &quot;message&quot;: &quot;bla bla bla&quot;
    ]
  }
  </code></pre>
  <p>The exception: <code>com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of &quot;org.example.app.Foo$Error&quot; (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('message')</code></p>
  <p>The app:</p>
  <pre class="lang-java prettyprint-override"><code>@SpringBootApplication
  public class Application {
    public static void main(String[] args) throws Exception {
      ApplicationContext context = SpringApplication.run(Application.class, args);
      ObjectMapper objectMapper = context.getBean(ObjectMapper.class);
      Resource resource = new ClassPathResource(&quot;request.json&quot;);
      try (InputStream stream = resource.getInputStream()) {
          Foo foo = objectMapper.readValue(stream, Foo.class);
          System.out.println(foo);
      }
    }
  }
  </code></pre>
  <p>The JSON file resides on the classpath.</p>
  <p>What I've tried:</p>
  <ol>
  <li>Explicit <code>@AllArgsConstructor</code> Lombok annotation on <code>Error</code> class</li>
  <li>Switching from <code>int code</code> to <code>Integer code</code> (nullable type)</li>
  <li>Moving <code>Error</code> class out of <code>Foo</code> (non-inner class)</li>
  </ol>