I have the following enum:
enum class Scopes(val value: Int) {
NODE(0),
API(1),
PROJECT(2),
GLOBAL_TO_OWNER(3),
PUBLIC_TO_ANYONE(4)
}
I would like to serialize this so that the enum value (its ordinal) is exported as an integer and not as a string. Example:
{"scope": 1}
What I don't want is:
{"scope": "1"}
If this can be done using Gson, that is preferred. If not, perhaps a native Kotlin approach might do.