JsonIgnoreProperties depth on a field #184
Replies: 1 comment 2 replies
-
You might want to ask over at Kotlin module repo |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am struggling to achieve a piece of behaviour with Jackson in Kotlin.
A minimal example is:
The fact that
Child
must be a separatedata class
toParent
, rather than including its properties directly in the constructor ofParent
, is a requirement of the data structure.In this example, I must ignore the value of
class
on the@JsonUnwrapped
Child
instance, since otherwise there would be a clash when serialising betweenParent.class
andParent.base.class
. However, using@field:JsonIgnoreProperties("class")
also ignores theclass
property on theaction
, meaning that the data serialises to:Is there any way of specifying a property to be ignored using the
@JsonIgnoreProperties
annotation only to a certain depth, or alternatively, by the class type in which it appears? (e.g@field:JsonIgnoreProperties("Child::class")
)Beta Was this translation helpful? Give feedback.
All reactions