Play Framework: How to serialize/deserialize an enumeration to/from JSON

前端 未结 5 1201
有刺的猬
有刺的猬 2020-12-29 20:43

Given the following enumeration...

object MyEnum extends Enumeration {

  type MyEnum = Value

  val Val1 = Value(\"val1\")
  val Val2 = Value(\"val2\")
  va         


        
5条回答
  •  庸人自扰
    2020-12-29 21:26

    implicit val genderReads = Reads.enumNameReads(Gender) is working fine for me. Play Scala 2.4.2

提交回复
热议问题