sample JSON
"posts": [{
"id": 1,
"author": "Rylee Paul",
"authorId": 9,
"likes": 960,
"popularity": 0.13,
"reads": 50361,
"tags": [ "tech", "health" ]
},
一个实体类
private int id;
private String author;
private int authorId;
private int likes;
private double popularity;
private long reads;
@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
private List<String> tags;
service
ResponseEntity<Post []> responseEntity =restTemplate.getForEntity(url,Post[].class,tagName);
Post [] posts=responseEntity.getBody();
getForEntity报错了,
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `[Lcom.example.demo.data.Post;` from Object value (token `JsonToken.START_OBJECT`)
有没有哪位知道这是咋回事?