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