Json Property
Can be added to a data class property or enum instance to specify the name that is used when serializing it to and from JSON.
This is useful when integrating with an API that uses snake_case for example.
Using this is equivalent to using the Json annotation with the benefit that this annotation can be stripped using code shrinkers because of its retention.
Example:
@JsonSerializable
data class User(
@JsonProperty(name = "full_name")
val fullName: String,
)
Content copied to clipboard