I have a set of case objects that inherits from a trait as below:
sealed trait UserRole
case object SuperAdmin extends UserRole
case object Admin extends UserRole
case object User extends UserRole
I want to serialize this as JSON and I just used the Format mechanism:
implicit val userRoleFormat: Format[UserRole] = Json.format[UserRole]
But unfortunately, the compiler is not happy and it says:
No unapply or unapplySeq function found
What is wrong in my case objects?