MapKey

@Target(allowedTargets = [AnnotationTarget.PROPERTY])
annotation class MapKey(val name: String)

Annotation used to specify a custom key for a property during object to/from map conversion.

By default, the property name is used with snake_case <-> camelCase conversion. This annotation allows overriding it, which is useful when map key names should not match property names e.g., userId vs user

See also

Properties

Link copied to clipboard

Key name that will be used in the map.