title: No Json formatter found for type
body: <p>Note:  See code at the bottom of the question to see the answer</p>
  
  <p>I added the DataNode as a List property of itself and started getting the following compile error.  Is it possible to have a property of the class it is in?</p>
  
  <p>I am getting a compile error:</p>
  
  <p>ItemInquiry.scala:21: No Json formatter found for type List[models.DataNode]. Try to implement an implicit Format for this type.
  [error]     (__ \ "dataNodes"   ).format[List[DataNode]]</p>
  
  <pre><code>package models
  
  import play.api.libs.json._
  import play.api.libs.functional.syntax._
  
  
  case class ItemSearchResult(criteria: String, site: String, searchTime: Int, exact: Boolean, searchResults: List[Item])
  
  case class Item(name: String, upc: String, description: String, dataNodes: List[DataNode])
  
  case class DataNode(typeVal: String, title: String, subTitle: String, requiredRole: String, dataNodes: List[DataNode])
  
  
  object ItemSearchResult {
  
    implicit val dataNode = (
      (__ \ "type"        ).format[String] and
      (__ \ "title"       ).format[String] and
      (__ \ "requiredRole").format[String] and
      (__ \ "subTitle"    ).format[String] and
      (__ \ "dataNodes"   ).format[List[DataNode]]
     )(DataNode.apply _, unlift(DataNode.unapply _))
  
    implicit val item = ((__ \ "name").format[String] and
      (__ \ "upc").format[String] and
      (__ \ "description").format[String] and
      (__ \ "dataNodes").format[List[DataNode]])(Item.apply _, unlift(Item.unapply _))
  
    implicit val itemSearchResult = (
      (__ \ "criteria").format[String] and
      (__ \ "site").format[String] and
      (__ \ "searchTime").format[Int] and
      (__ \ "exact").format[Boolean] and
      (__ \ "searchResults").format[List[Item]])(ItemSearchResult.apply _, unlift(ItemSearchResult.unapply _))
  }
  </code></pre>
  
  <p>UPDATED With Exact code that fixed my issue:</p>
  
  <pre><code>package models
  
  import play.api.libs.json._
  import play.api.libs.functional.syntax._
  
  
  case class ItemSearchResult(criteria: String, site: String, searchTime: Int, exact: Boolean, searchResults: List[Item])
  
  case class Item(name: String, upc: String, description: String, dataNodes: List[DataNode])
  
  case class DataNode(typeVal: String, title: String, subTitle: String, requiredRole: String, dataNodes: List[DataNode])
  
  object ItemSearchResult {
  
    implicit val itemSearchResultFormat : Writes[ItemSearchResult] =(
        (__ \'criteria).write[String] and
        (__ \'site).write[String] and
        (__ \'searchTime).write[Int] and
        (__ \'exact).write[Boolean] and
        (__ \'searchResults).lazyWrite(Writes.traversableWrites[Item](itemFormat))
      )(unlift(ItemSearchResult.unapply))
  
    implicit val itemFormat : Writes[Item] =(
        (__ \'name).write[String] and
        (__ \'upc).write[String] and
        (__ \'description).write[String] and
        (__ \'dataNodes).lazyWrite(Writes.traversableWrites[DataNode](dataNodeFormat))
      )(unlift(Item.unapply))
  
    implicit val dataNodeFormat : Writes[DataNode] =(
        (__ \'type).write[String] and
        (__ \'title).write[String] and
        (__ \'subTitle).write[String] and
        (__ \'requiredRole).write[String] and
        (__ \'dataNodes).lazyWrite(Writes.traversableWrites[DataNode](dataNodeFormat))
      )(unlift(DataNode.unapply))
  }
  </code></pre>