DrifterEncoder

@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class DrifterEncoder

Marks a function as a custom encoder for a specific type during JSON serialization.

This annotation allows you to define custom logic for converting objects of a specific type into a format suitable for JSON. This is useful when the default serialization behavior doesn't meet your needs or requires specific transformations.

The annotated function takes an object of the specified type as input and returns a JSON-compatible value.

Example Usage:

@DrifterEncoder
fun Color.encodeFromColor(): Int = toArgb()

// ... in a serialization method

val json = JSONObject()
waterColor?.let { json.put("waterColor", it.encodeFromColor()) }