title: No implicit format for MyClass available using Json.format
body: <p>I'm getting an error when using a complex object as attribute of another object on Json.format.</p>
  
  <p>I have two classes: <strong>RoleDTO</strong> and <strong>EmailInvitationDTO</strong>. <strong>EmailInvitationDTO</strong> has a <strong>RoleDTO</strong>. So, I declared:</p>
  
  <pre><code>case class RoleDTO(id:Option[Long] = None, roleType:Int, userID:Long, fromHousingUnitID:Option[Long] = None, isAdmin:Option[Boolean] = None, fromResidentUserID:Option[Long] = None, documentNumber:Option[String] = None, fromCondoID:Option[Long] = None)
  object RoleDTO { val roleFormat = Json.format[RoleDTO] }
  
  case class EmailInvitationDTO(firstName:String, lastName:String, email:String, role:RoleDTO)
  object EmailInvitationDTO{ val emailInvitationFormat = Json.format[EmailInvitationDTO] }
  </code></pre>
  
  <p>I'm getting the error: No implicit format for <strong>RoleDTO</strong> available. Even if I declare the <strong><em>roleFormat</em></strong> variable in a line before <strong><em>emailInvitationFormat</em></strong>:</p>
  
  <pre><code>object EmailInvitationDTO {
      val roleFormat = Json.format[RoleDTO]
      val emailInvitationFormat = Json.format[EmailInvitationDTO]
  }
  </code></pre>
  
  <p>Anyone knows what is missing? Thanks.</p>