title: Swift 4 decodable json arrays
body: <p>So I am currently woking on a program to parse a JSON Api which is linked at the bottom</p>
  
  <p>When I run the code I get some output but not all <img src="https://i.stack.imgur.com/DZARB.png" alt="image of console output"></p>
  
  <p>Mainly for the optional type of Anime which is good because it shows that it works but I also want to access the name and release date and languages however I have no idea how to work with JSON arrays like this in swift 4. I will attach my current code below. </p>
  
  <pre><code>import UIKit
  
  struct AnimeJsonStuff: Decodable {
      let data: [AnimeDataArray]
  }
  
  struct AnimeDataArray: Decodable {
      let type: String?
  }
  
  class OsuHomeController: UICollectionViewController, UICollectionViewDelegateFlowLayout {
      func jsonDecoding() {
          let jsonUrlString = "https://kitsu.io/api/edge/anime"
  
          guard let url = URL(string: jsonUrlString) else {return} //
          URLSession.shared.dataTask(with: url) { (data, response, err) in
  
              guard let data = data else {return}
  
              do {
                  let animeJsonStuff =  try JSONDecoder().decode(AnimeJsonStuff.self, from: data)
                  print(animeJsonStuff.data)
  
                  let animeDataArray = try JSONDecoder().decode(AnimeDataArray.self, from: data)
                  print(animeDataArray.type as Any)
              } catch let jsonErr {
                  print("Error serializing json", jsonErr)
              }
          }.resume()
      }
  }
  </code></pre>
  
  <p>I have more code after that but it's just for setting up custom collectionViewCells. </p>
  
  <p>Also here is the link to the <a href="http://docs.kitsu.apiary.io/#reference/media/anime/fetch-collection?console=1" rel="noreferrer">api</a></p>