我有一个 Java 对象“作者”,然后它被重组为“作者”的 Ararylist。Author 对象直接作为 JSON 保存在 DB 中,如下所示:
{"author":{"id":1,"recordId":0}}
所以我早期的 Java 字段是:
private Author author = new Author();
新的是:
private List<Author> authorList;
问题是我如何编写代码以使用authorList序列化对象,但还需要反序列化旧的“ Author ”。
我使用@JsonProperty读取已保存的author数据,但这也保存了名为“Author”的 Arraylist,我需要将其命名为authorList
@JsonProperty(value="author")
@JsonDeserialize(using = AuthorDeserializer.class)
精慕HU
拉莫斯之舞
肥皂起泡泡
相关分类