title: MismatchedInputException - Jackson deserialize
body: <p>I'm trying to read my <em>.json</em> file. Is is a <code>VehicleRepository</code> class.</p>
  
  <pre><code>"{\"vehicles\":[{\"id\":\"9467d079-4502-4dba-9d23-b8506dfc7ef4\",\"plate\":\"ghghghhg\",\"manufacturer\":\"Alfa Romeo\",\"model\":\"hgghgh\",\"color\":\"Amarelo\"}]}"
  </code></pre>
  
  <p>This is the error:</p>
  
  <blockquote>
    <p>com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of <code>VehicleRepository</code> (although at least one Creator exists): Cannot construct instance of <code>VehicleRepository</code> (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value at [Source: (File); line: 1, column: 1]</p>
  </blockquote>
  
  <p>To create the <code>.json</code> file I'm using this:</p>
  
  <pre><code>repository.vehicles = new ArrayList&lt;Vehicle&gt;();
  repository.vehicles.add(vehicle);           
  
  json = mapper.writeValueAsString(repository);   
  
  ObjectMapper write = new ObjectMapper();
  write.writeValue(new File("Database//Vehicles.json"), json);
  </code></pre>
  
  <p>And to read the <code>.json</code> file I'm using this:</p>
  
  <pre><code>VehicleRepository newRepository = mapper.readValue(new File("Database\\Vehicles.json"), VehicleRepository.class);   
  </code></pre>
  
  <p><strong>And it's in the above line that the error occurs.</strong>        </p>
  
  <p>This is my <code>Vehicle</code> class:</p>
  
  <pre><code>public class Vehicle {
  
      private String id;
      private String plate;
      private String manufacturer;
      private String model;
      private String color;
  
      public Vehicle() {}
  
      public Vehicle(String plate, String manufacturer, String model, String color) {
          this.id = UUID.randomUUID().toString();
          this.plate = plate;
          this.manufacturer = manufacturer;
          this.model = model;
          this.color = color;
      }
  
      public Vehicle(String id, String plate, String manufacturer, String model, String color) {
          this.id = id;
          this.plate = plate;
          this.manufacturer = manufacturer;
          this.model = model;
          this.color = color;
      }
  
      public String getId() {
          return id;
      }
  
      public String getPlate() {
          return plate;
      }
  
      public void setPlate(String plate) {
          this.plate = plate;
      }
  
      public String getManufacturer() {
          return manufacturer;
      }
  
      public void setManufacturer(String manufacturer) {
          this.manufacturer = manufacturer;
      }
  
      public String getModel() {
          return model;
      }
  
      public void setModel(String model) {
          this.model = model;
      }
  
      public String getColor() {
          return color;
      }
  
      public void setColor(String color) {
          this.color = color;
      }
  }
  </code></pre>
  
  <p>And this is my <code>VehicleRepository</code> class:</p>
  
  <pre><code>public class VehicleRepository {
  
      List&lt;Vehicle&gt; vehicles;
  
      public VehicleRepository() {
  
      }
  
      public List&lt;Vehicle&gt; getVehicles() {
          return vehicles;
      }
  
      public void setVehicles(List&lt;Vehicle&gt; vehicles) {
          this.vehicles = vehicles;
      }
  }
  </code></pre>
  
  <p>Can someone help me?</p>