@JsonProperty() in getters
See original GitHub issueIs it possible to add @JsonProperty decorator to a getter function?
@Serializable()
class MyClass {
@JsonProperty()
get myProperty(): string { return this.myProperty }
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
JsonProperty annotation on field as well as getter/setter
The purpose is so that when the object is serialized using the Jackson library, the fields have that specific name.
Read more >JsonProperty (Jackson-annotations 2.9.0 API) - FasterXML
Marker annotation that can be used to define a non-static method as a "setter" or "getter" for a logical property (depending on its...
Read more >Jackson JSON - Using @JsonProperty, @JsonSetter and ...
Following example shows how to use @JsonProperty annotation to rename properties. This annotation can be used on fields or getters or setters.
Read more >Jackson Annotations - @JsonProperty - Tutorialspoint
@JsonProperty is used to mark non-standard getter/setter method to be used with respect to json property. Example - @JsonProperty. import java.io.
Read more >About @JsonProperty, @JsonGetter and @JsonSetter
@JsonProperty: Marker annotation that can be used to define a non-static method as a "setter" or "getter" for a logical property (depending on ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Of course in this example does not make sense, but as soon as we have domain models and we want it to serialize them hierarchically to convert them to DTOs it is really handful to have this functionality:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.