title: Error "Could not extract response: no suitable HttpMessageConverter found for response type ... and and content type [application/json]"
body: <p>I'm sending a GET request to another service which returns in this format:</p>
  
  <pre><code>{
      "data": [
          {
              "email": "eskaferas@gmail.com",
              "firstName": "Seras",
              "lastName": "Meras"
          },
          {
              "email": "Soras@gmail.com",
              "firstName": "Oras",
              "lastName": "Moras"
          },
          {
              "email": "bzbzb@gmail.com",
              "firstName": "hello",
              "lastName": "bye"
          },
          {
              "email": "lrc@gmail.com",
              "firstName": "Seras",
              "lastName": "Meras"
          }
      ],
      "message": "Success"
  }
  </code></pre>
  
  <p>I'm using a ResponseEntity this way:</p>
  
  <pre><code>@GetMapping("/todos/{toDoNoteId}/users")
      public ResponseEntity getNotesUsersTest(@PathVariable int toDoNoteId) {
          ToDoNote note = toDoNoteService.getToDoNoteById(toDoNoteId);
          if(note==null) {
              throw new ToDoNoteNotFoundException("Note with id "+ toDoNoteId + " not found");
  
          }
          RestTemplate restTemplate = new RestTemplate();
          final String uri = "http://friend:5000/users";
  
          try {
              ResponseEntity&lt;ArrayResponsePojo&gt; result = restTemplate.exchange(uri, HttpMethod.GET,null, new ParameterizedTypeReference&lt;ArrayResponsePojo&gt;() {}); 
              return result;
  
          }
          catch (HttpClientErrorException ex) {
              return ResponseEntity.status(ex.getRawStatusCode()).headers(ex.getResponseHeaders())
                      .body(ex.getResponseBodyAsString());
  
          }
  
      }
  </code></pre>
  
  <p>However when sending the GET request I get this response:
  Type definition error: [simple type, class com.tdl.model.ArrayResponsePojo]; nested exception is <code>com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of</code>com.tdl.model.ArrayResponsePojo<code>(no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)\n at [Source: (sun.net.www.protocol.http.HttpURLConnection$HttpInputStream); line: 2, column: 5]",</code></p>
  
  <p>I don't know why I get this exeption since I do have Contructors. Here are is my pojo Class:</p>
  
  <pre><code>public class ArrayResponsePojo {
      private User[] data;
      private String message;
  
      public User[] getData() {
          return data;
      }
      public void setData(User[] data) {
          this.data = data;
      }
      public String getMessage() {
          return message;
      }
      public void setMessage(String message) {
          this.message = message;
      }
  
      @JsonCreator
      public ArrayResponsePojo(User[] data, String message) {
          this.data = data;
          this.message = message;
      }
  
  }
  </code></pre>
  
  <p>And my user class:</p>
  
  <pre><code>public class User {
  
       private String email;
       private String firstName;
       private String lastName;
  
       @JsonCreator
       public User(String email, String firstName, String lastName) {
          super();
          this.email = email;
          this.firstName = firstName;
          this.lastName = lastName;
      }
  
      public String getEmail() {
           return email;
       }
       public void setEmail(String email) {
           this.email = email;
       }
       public String getFirstName() {
           return firstName;
       }
  
       public void setFirstName(String firstName) {
          this.firstName = firstName;
       }
       public String getLastName() {
          return lastName;
       }
       public void setLastName(String lastName) {
           this.lastName = lastName;
       }
  
  }
  </code></pre>
  
  <p>I tried both without and with the ParameterizedTypeReference.
  Can anybody please help. I have no clue on how to fix this.</p>
  
  <p><strong>EDIT</strong>
  After adding the constructors I'm getting this instead.:</p>
  
  <pre><code>"Could not extract response: no suitable HttpMessageConverter found for response type [class com.tdl.model.ArrayResponsePojo] and content type [application/json]".
  </code></pre>
  
  <p>Every other example of this problem was dealing with a different response type than application/json.</p>
  
  <p>I also tried setting the header to application/json.</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>If I set the responseEntity type to String I'm able to receive the response. However, I need to receive the responses to my POJO class</p>
  
  <p><strong>EDIT 3</strong>
  I found a few warnings with the debugger that the JsonCreators could not be used. Then i added JsonProperty to the constructor parameters(or just empty constructors) and now it does not return an error but hangs for 30s or so and only then returns the expected result.
  I opened another question for that here since it is a different issue:<a href="https://stackoverflow.com/questions/55763945/resttemplate-super-slow-for-get-request">Resttemplate super slow for GET request</a></p>