title: Spring Boot: InvalidTypeIdException When Trying to Parse Json
body: <p>I am trying to map POJO to a JSON response I get; however, I keep getting this error:</p>
  
  <pre><code>com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve type id 'order' as a subtype of `com.issbou.entity.OrdersList`: known type ids = [orders]
  </code></pre>
  
  <p>The Json response I get from the server and which I am trying to map to my POJO classes is:</p>
  
  <pre><code>{
    "orders": [
      {
        "id": 2039665099999,
        "email": "isx@gmail.com"
      },
      {
        "id": 2039665066666,
        "email": "yzy@gmail.com"
      }
              ]
  }
  </code></pre>
  
  <p><strong>Order</strong>:Java Entity Class that represents a single order:</p>
  
  <pre><code>import com.fasterxml.jackson.annotation.JsonProperty;
  import lombok.Getter;
  import lombok.Setter;
  
  @Setter
  @Getter
  public class Order {
  
      @JsonProperty("id")
      private long id;
  
      @JsonProperty("email")
      private String email;
  
  }
  </code></pre>
  
  <p><strong>OrderList</strong>:Java Entity Class that creates a lit of single orders:</p>
  
  <pre><code>import com.fasterxml.jackson.annotation.JsonProperty;
  import com.fasterxml.jackson.annotation.JsonTypeInfo;
  import com.fasterxml.jackson.annotation.JsonTypeName;
  import lombok.Getter;
  import lombok.Setter;
  
  
  @JsonTypeName("orders")
  @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT ,use = JsonTypeInfo.Id.NAME)
  @Setter
  @Getter
  public class OrdersList {
  
      private List&lt;Order&gt; singleOrder;
  
  
  }
  </code></pre>
  
  <p>Service class: </p>
  
  <pre><code>@Service
  public class BasicAuth {
  
     public ResponseEntity&lt;OrdersList&gt; orderDetails (@RequestBody OrdersList order){
  
         String username = "username";
         String password = "password";
         HttpHeaders headers = new HttpHeaders();
         headers.setBasicAuth(username, password);
  
         // request url
         String url = "https://test.myshopify.com/admin/orders.json";
  
         RestTemplate restTemplate = new RestTemplate();
  
  
         HttpEntity request = new HttpEntity(headers);
  
         ResponseEntity&lt;OrdersList&gt; response = restTemplate.exchange(
                 url, HttpMethod.GET, request, OrdersList.class);
  
         return response;
     }
  
  }
  </code></pre>
  
  <p>Rest Controller:</p>
  
  <pre><code>@RestController
  public class Controller {
  
      @Autowired
      BasicAuth basicAuth;
  
      @GetMapping("/lok")
      @ResponseStatus(HttpStatus.FOUND)
      public ResponseEntity&lt;OrdersList&gt; getBasicAut(OrdersList ordersList){
  
          return basicAuth.orderDetails(ordersList);
      }
  
  }
  </code></pre>