title: JSON serialization of Scala enums using Jackson
body: <p>Following this article <a href="https://github.com/FasterXML/jackson-module-scala/wiki/Enumerations" rel="noreferrer">https://github.com/FasterXML/jackson-module-scala/wiki/Enumerations</a></p>
  
  <p>The enumeration declaration is as </p>
  
  <pre><code>object UserStatus extends Enumeration {
    type UserStatus = Value
    val Active, Paused = Value
  }
  
  class UserStatusType extends TypeReference[UserStatus.type]
  case class UserStatusHolder(@JsonScalaEnumeration(classOf[UserStatusType]) enum:   UserStatus.UserStatus)
  </code></pre>
  
  <p>The DTO is declared as</p>
  
  <pre><code>class UserInfo(val emailAddress: String, val  userStatus:UserStatusHolder) {
  
  }
  </code></pre>
  
  <p>and the serialization code is</p>
  
  <pre><code>val mapper = new ObjectMapper()
  mapper.registerModule(DefaultScalaModule)
  
  def serialize(value: Any): String = {
      import java.io.StringWriter
      val writer = new StringWriter()
      mapper.writeValue(writer, value)
      writer.toString
  }
  </code></pre>
  
  <p>The resulting JSON serialization is </p>
  
  <pre><code>{
      "emailAddress":"user1@test.com",
      "userStatus":{"enum":"Active"}
  }
  </code></pre>
  
  <p>Is it possible to get it the following form ? </p>
  
  <pre><code>{
      "emailAddress":"user1@test.com",
      "userStatus":"Active"
  }
  </code></pre>