Jackson 对象映射器在 json 中添加了“stability”字段

Jackson object mapper adds "stability" field in json

提问人:lokesh 提问时间:10/24/2023 更新时间:10/24/2023 访问量:66

问:

在序列化数据模型时,我获得了额外的字段“稳定性”。这是模型中未定义的内容。这仅在 Android 14 中发生,因此这似乎在 Android 14 以下的 API 中有效。

我在杰克逊版本上。2.13.3

这是我的模型的样子


@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

我正在对模型进行序列化,如下所示


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

stringValue打印出来如下;

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

我找不到任何来自字段的参考。stability

我试过了.这似乎没有奏效。@JsonIgnoreProperties@JsonPropertyOrder

感谢您的帮助!

Android JSON 杰克逊数据绑定 android-14

评论

2赞 ianhanniballake 10/24/2023
你看到这个相关的问题了吗?
0赞 lokesh 10/24/2023
我从来没有想过这可能与 Parcelable 有关。谢谢。我没有看到相关的问题。我仍然不明白为什么这在 Android 13 和 Android 14 中表现不同。你知道我在这里错过了什么吗?

答: 暂无答案