我有两个实体:
Parent {
Child[] children;
}
and
Child {
Parent parent;
}
我知道@JsonBackReference
和@JsonManagedReference
.
但我还需要转移Child
个实例,我希望填充parent
字段.
In other words:
- On serialization of
Parent
it should havechildren
but their parent field might be empty (can be solved by using json reference annotations). - 在
Child
的序列化中,应该有parent
和children
(但children
不必填充parent
).
有没有办法使用标准的Jackson功能来解决这个问题?
即跳过已经串行化的实体的串行化,而不是标记符合串行化条件或不符合串行化条件的字段.