Java 尝试使用Spring REST时出现的问题

Java 尝试使用Spring REST时出现的问题,java,spring,rest,jackson,Java,Spring,Rest,Jackson,我有一个REST服务已经开始工作,它返回下面的示例JSON: { "_embedded" : { "artist" : [ { "name" : "+44", "genre" : "Rock", "country" : "USA", "id" : 469, "_links" : { "self" : { "href" : <ADDRESS>

我有一个REST服务已经开始工作,它返回下面的示例JSON:

{
   "_embedded" : {
     "artist" : [ {
       "name" : "+44",
       "genre" : "Rock",
       "country" : "USA",
       "id" : 469,
       "_links" : {
         "self" : {
           "href" : <ADDRESS>
         },
         "albumList" : {
           "href" : <ADDRESS>
         }
       }
     } ]
   }
}
当debbuger点击getForObject行时,会出现以下错误:

Exception in thread "main" org.springframework.http.converter.HttpMessageNotReadableException:
Could not read JSON: Can not deserialize instance of br.com.lagranzotto.itunes.frontend.entity.Artist[] out of START_OBJECT token

我已经在互联网上广泛搜索了大约一周,但没有找到导致此异常的原因。

看起来您在web服务中使用的是Spring Data PagedResources,因此返回的艺术家数据列表封装在JSON的
\u embedded
属性中。所以RestTemplate不知道如何反序列化它

看看奥利弗·吉尔克的回答

Exception in thread "main" org.springframework.http.converter.HttpMessageNotReadableException:
Could not read JSON: Can not deserialize instance of br.com.lagranzotto.itunes.frontend.entity.Artist[] out of START_OBJECT token