abstract fun serialNameForJson(descriptor: SerialDescriptor, elementIndex: Int, serialName: String): String

Accepts an original serialName (defined by property name in the class or SerialName annotation) and returns a transformed serial name which should be used for serialization and deserialization.

Besides string manipulation operations, it is also possible to implement transformations that depend on the descriptor and its element (defined by elementIndex) currently being serialized. It is guaranteed that descriptor.getElementName(elementIndex) == serialName. For example, one can choose different transformations depending on SerialInfo annotations (see SerialDescriptor.getElementAnnotations) or element optionality (see SerialDescriptor.isElementOptional).

Note that invocations of this function are cached for performance reasons. Caching strategy is an implementation detail and should not be assumed as a part of the public API contract, as it may be changed in future releases. Therefore, it is essential for this function to be pure: it should not have any side effects, and it should return the same String for a given descriptor, elementIndex, and serialName, regardless of the number of invocations.