# Enum in Kotlin

**URL:** <https://discuss.kotlinlang.org/t/enum-in-kotlin/22527>\
**Category:** Android\
**Created:** [July 26, 2021, 11:43am UTC](https://discuss.kotlinlang.org/t/enum-in-kotlin/22527 "2021-07-26T11:43:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Varsha](https://avatars.discourse-cdn.com/v4/letter/v/aeb1de/32.png) [@Varsha](https://discuss.kotlinlang.org/u/Varsha)\
**Post date:** [July 26, 2021, 11:43am UTC](https://discuss.kotlinlang.org/t/enum-in-kotlin/22527/1 "2021-07-26T11:43:11Z")

</div>

const val START\_ACTION = “start”

## enum class Actions(val info: String) { START(START\_ACTION) }

## @Serializable data class ActionRequest( @SerialName(“action\_type”). —\> backend datatype val actionType: Actions. ----\> enum is compulsory to use here )

## val actionRequest = ActionRequest(actionType = START)

Here, I am getting output is “START” rather than “start”.

Can someone please help me with how to get the value of action?

---

<div class="post-metadata">

**Author:** ![broot](https://avatars.discourse-cdn.com/v4/letter/b/a88e57/32.png) [@broot](https://discuss.kotlinlang.org/u/broot)\
**Post date:** [July 26, 2021, 11:55am UTC](https://discuss.kotlinlang.org/t/enum-in-kotlin/22527/2 "2021-07-26T11:55:20Z")

</div>

You can do it like this:

```auto
@Serializable
enum class Actions(val info: String) {
    @SerialName(START_ACTION) START(START_ACTION)
}

```

You can remove `info` property if you planned to use it solely for serialization purposes.

---

<div class="post-metadata">

**Author:** ![Varsha](https://avatars.discourse-cdn.com/v4/letter/v/aeb1de/32.png) [@Varsha](https://discuss.kotlinlang.org/u/Varsha)\
**Post date:** [July 26, 2021, 12:58pm UTC](https://discuss.kotlinlang.org/t/enum-in-kotlin/22527/3 "2021-07-26T12:58:12Z")

</div>

Thank you.  
For the fixing the above issue, I need to use a custom Serializer.  
This issue is fixed now
