Skip to content

@JsonProperty not honored in superclass fields #474

@marshallpierce

Description

@marshallpierce

Describe the bug
Controlling the serialized field name with @JsonProperty doesn't appear to be working for fields in a superclass.

To Reproduce

open class Parent(@JsonProperty("parent-prop") val parent: String)
class Child(@JsonProperty("child-prop") val child: String) : Parent(child)

println(jacksonObjectMapper().writeValueAsString(Child("foo")))

yields {"child-prop":"foo","parent":"foo"}.

Expected behavior

I would expect to see {"child-prop":"foo","parent-prop":"foo"}.

Versions
Kotlin: 1.5.20
Jackson-module-kotlin: 2.12.3
Jackson-databind: 2.12.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions