title: Play ScalaJSON Reads[T] parsing ValidationError(error.path.missing,WrappedArray())
body: <p>i have a funny json data looking as:</p>
  
  <pre><code>[ {
    "internal_network" : [ {
      "address" : [ {
        "address_id" : 2,
        "address" : "172.16.20.1/24"
      }, {
        "address_id" : 1,
        "address" : "172.16.30.30/24"
      } ]
    } ],
    "switch_id" : "0000000000000001"
  }, {
    "internal_network" : [ {
      "address" : [ {
        "address_id" : 2,
        "address" : "172.16.30.1/24"
      }, {
        "address_id" : 1,
        "address" : "192.168.10.1/24"
      }, {
        "address_id" : 3,
        "address" : "172.16.10.1/24"
      } ]
    } ],
    "switch_id" : "0000000000000002"
  } ]
  </code></pre>
  
  <p>i wrote case classes and custom reads:</p>
  
  <pre><code>  case class TheAddress(addr: (Int, String))
    implicit val theAddressReads: Reads[TheAddress] = (
      (__ \ "address_id").read[Int] and
        (__ \ "address").read[String] tupled) map (TheAddress.apply _)
  
    case class Addresses(addr: List[TheAddress])
    implicit val addressesReads: Reads[Addresses] =
      (__ \ "address").read(list[TheAddress](theAddressReads)) map (Addresses.apply _)
  
    case class TheSwitch(
      switch_id: String,
      address: List[Addresses] = Nil)
    implicit val theSwitchReads: Reads[TheSwitch] = (
      (__ \ "switch_id").read[String] and
      (__ \ "internal_network").read(list[Addresses](addressesReads)))(TheSwitch)
  
    case class Switches(col: List[TheSwitch])
    implicit val switchesReads: Reads[Switches] = 
      (__ \ "").read(list[TheSwitch](theSwitchReads)) map (Switches.apply _)
  </code></pre>
  
  <p>when i validate the provided data with:</p>
  
  <pre><code>val json: JsValue = Json.parse(jsonChunk)
  println(json.validate[TheSwitch])
  </code></pre>
  
  <p>i get:</p>
  
  <pre><code>JsError(List((/switch_id,List(ValidationError(error.path.missing,WrappedArray()))), (/internal_network,List(ValidationError(error.path.missing,WrappedArray())))))
  </code></pre>
  
  <p>i can access it with JsPath like</p>
  
  <pre><code>val switches: Seq[String] = (json \\ "switch_id").map(_.as[String])
  </code></pre>
  
  <p>but i'm really at my wits end with what am i doing wrong with custom reads.
  i've tried with putting another top level key, and other combinations, but seems i'm missing something crucial, since i've started with this just today.</p>
  
  <p>thanks a lot.</p>