-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Right now it's not possible to annotate a function with @JsonProperty and have it be included in the json.
For example, following kotlin code will be serialized into an empty json object:
class Obj {
val name
get() = "John Doe"
}If @JsonProperty would be allowed for methods, we could write the above code as follows:
class Obj {
@get:JsonProperty("name")
val name
get() = "John Doe"
}And have it be included in the serialized form. Alternatively, the serialization could include all getters by default. Jackson's ObjectMapper does the same:
class Obj {
val name
get() = "John Doe"
}
println(ObjectMapper().writeValueAsString(Obj()))prints
{"name":"John Doe"}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels