链式解析json报错
Topic source问题解决了,由于我的Bean里的author仍然String类型,而json文件解析出来应该是一个Object,
所以我创建了一个Author类:
@Datapublic class Author { @JsonProperty("firstName") private String firstName; @JsonProperty("lastName") private String lastName;}
完成解析
或者不另外创建类,在bean中对嵌套的json对象给一个注解
@JsonProperty("author")public JsonNode author;
完成解析
- 1
不器
json文件里的key值author无法解析,报错
Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
at [Source: (FileInputStream); line: 4, column: 13] (through reference chain: org.example.Book["author"])
求解答。