Jackson object mapper adds "stability" field in json

344 views Asked by At

I am getting extra field "stability" when serializing the data model. This something that's not defined in the model. This is happening in Android 14 only, so this seems to be working in API below Android 14.

I am on Jackson version 2.13.3.

This is what my model looks like


@Parcelize
data class Address(
    @JsonProperty("line1")
    val line1: String,
    @JsonProperty("line2")
    val line2: String?,
    @JsonProperty("city")
    val city: String,
    @JsonProperty("state")
    val state: String,
    @JsonProperty("postalCode")
    val postalCode: String
) : Parcelable

I am doing the serialization for the model as below


 val jsonWrapper = ObjectMapper()
 val stringValue = jsonWrapper.writeValueAsString(mockAddress)

stringValue is printed out as below;

{"address":{"line1":"","line2":null,"city":"","state":"","postalCode":"","stability":0}

I can't find any reference from where stability field is coming from.

I tried @JsonIgnoreProperties and @JsonPropertyOrder. That didn't seem to work.

Thanks for any help!

0

There are 0 answers